Thursday 30 November 2017

android - I click HOME button and the program minimizes; but when I press the app icon, the program is launched twice

I have the following
problem:



When I press the Android HOME key, I
can see the "Desktop" and my app icon. Then I press my app icon and my application
launches twice. I don't want open my app
twice.



How my program
works:



I have 4 Activities (A, B, C,
D).



A - The Main Activity: It is the first to
open. It opens the other activity that has a lot of buttons. It's like a Java's main()
method. I show a SplashScreen and I call another Activity. Then I
finish my activity
"A".




B - The Menu Screen: In this
activity, I have some buttons, like a menu. I have a configuration button, update
button, and Login Button. When I click the login button, I finish this activity and open
the Login Screen (Activity "C").



C - The Login
Screen: The user writes the Login and Password. If the login is successful, I finish
this activity and open the Activity "D".



D - The
application main screen: It stays opened all the time and launches another Activities. I
finish this when I want close my
application.



P.S.: I tried change the launchMode
flag (androidManifest.xml), but didn't work.



My
AndroidManifest.xml
bellow:




            android:label="@string/app_name" android:icon="@drawable/icon"
android:name="MyApplication">

android:label="@string/app_name"

android:configChanges="orientation">



android:name="android.intent.category.LAUNCHER" />



android:name="br.com.site.B" android:label="@string/app_name"
/>

android:label="@string/app_name" />
android:name="br.com.site.D" android:label="@string/app_name"
/>



And
this is my Activity "A.java"
source:



public class A extends
Activity {

@Override

public void
onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

finish();

startActivity(new Intent(this, AtualizaDadosFrame.class));

}
}


I
don't want open my app
twice.




Thanks in
advance!

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...