Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
In my app, my own Application class saved some static variables, after clicked home button in my application, the screen go back to home. now i want to resume my application, when i click my app icon in launcher, the variables of the variables before are null, but onlongclick home button and choose my application, the variables is normal~
When you click app icon from the launcher at that time second instance generated for your app.To solve this issue you have to manage with single instance. For that you can use
android:launchMode="singleTask" or
android:launchMode="singleInstance"
` in your manifest for activity
Refer this question too
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Suppose there is an application in which 3 users are registered. There is avtivity with three buttons. The user enters the application and can click on only one button (for each user own button), and on other buttons can not press. Tell me how to implement this. The application I make through Firebase.
You need to setup user authentication. You can read about that here:
https://firebase.google.com/docs/auth/android/start/
Basically, you need to create a user account and then take necessary actions depending on who the user is.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
hello everyone I want to know what happens when we click on app icon of any particular app.How OS launch that app?.Please describe it.
When you click on app icon android package manager will check manifest file and find launcher activity which has intent filter for that and will search for action as Main and category as default. When it find that detail it will launch that main activity.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I just created intro sample show some tips in my app with 3 fragments and it works well but it only appears to user when I made the intro activity in manifest as "launcher" activity. So it appears every time the user opens the app.
What I need is how to make this activity appears only the first time opening the app?
You can use SharedPreferences and set value in that when User will open it for the first time. after that Every time user open the App you can check that variable. If that value is set then you can directly call next Activity.
But for this approach you have to make that <activity> with attribute android:noHistory="true". then It will work.
You can set an activity before your intro and using SharedPrefereces you can store when user open your app for the first time. In the case that is the first time you start the example activity else you start the main activity.
You can save just a boolean value SharedPreferences
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to perform some activities like clearing cache, singletons clearing etc. I will write all this code in Service which will be background but I need this service to be triggered only when application is closed or exited.
I cant put my code to statrt service in onDestroy of activity as whenever i will move between my activities it will call onDestroy of previous activity.
How to know if application is exited.
Example will really help.
Thanks.
The ActivityManager should be what you are looking for.
For example see here
in your main activity, capture the "back" key and check for Activity.isTaskRoot() whether it is the last one. If yes, your app is going to "exit", then do some communication with your service.
please note pressing the Home key doesn't mean to "exit" your app
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
When I press home button in android phone
at ant time open my application
How I Do it, Please ???
And How I Exit from app (not go to the last Activity)
Overriding the Home Button is not a recommended thing to do. The Home Button serves as a panic/safe button for the user whenever something goes out of hand. Overriding the Home Button will present issues if you make it open another application.
You can override it to open another application, however, the Android OS will ask the user to choose between the default home button application (the one that brings you back to the home page of the device) or your application. At this moment, the user can set a default application to go to. If I'm not mistaken, it will take root access to completely override the home button in such a way that the above mentioned process of choosing a default application.