coming back to my app from before - android

i try to get my app done properly but i kind of stumble upon problems all the time.
So what happens:
-> home button is pressed
-> the android menu is shown
-> i click on my app again and it just shows the appname in the actionbar and a black screen. What do i have to do to come to my starting activity again?
This screen is also shown when i press the back button. On a second tap on the back button the app closes and when i start it again it starts with my startactivity...
I really don't know what i'm doing wrong here.
I'm calling finish() in the onPause, onStop and onDestroy.

Related

Android app changes home screen on suspend

When I suspend my app by pressing the home button, the app immediately disappears revealing the home screen. The top-most icon on the home screen is drawn inside a white shaded box, as if the icon is somehow selected. This happens before onPause() is run but does not happen if finish() is run.
This only happens with my app. I've seen it on Android 6 and 7. What could I be doing to cause this?
More information:
I can prevent this from happening if I activate a popup menu before pressing the home button.
Still more information:
Removing the 4th line makes the problem go away. This is a TextView.
curTitle.setFocusable(true);
curTitle.setFocusableInTouchMode(true);
curTitle.requestFocus();
//curTitle.requestFocusFromTouch();
I still don't understand it.
Thanks.
https://i.stack.imgur.com/sWJCQ.png

Go back to previous acitivity stack after pressing Home in Android launcher

I am developing a custom launcher/home-screen, thus I am able to hand home-press events.
Sometimes I want it to intercept Home-presses without affecting the visible activity-stack so to speak. When I press home, however, I get to the launcher stack I suppose, but what I want to do then is get back to the last visited activity stack that was shown right before I pressed home. How can I do that?
How can I retrieve and show the activity that was visible right before I pressed home?

Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED|Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

When these two flags are added(or set) to a new activity A, A becomes the top of task's back stack and is shown on the screen. Here HOME is pressed, and the screen shows home.
What I want: Then let's go to launcher and select the app's icon, the app comes alive again, the A is gone.
What I am confused: Then let's long press HOME and select the app, the app comes alive again, A is still THERE.
I want A disappeared, however from Launcher or from Recent. How can I make it?
I don't think there is any easy way to do this. You can either exclude your app from the Recent list or save a flag in activity A that if true call finish() in onCreate.

Terminate android app

I have an app with an intro screen, there will be two buttons in this screen (Ok and Cancel)
If the user clicks the cancel button the application will terminate, and if the user clicks the ok button ,the main screen appears, the main screen got a back button to go back to the intro screen.
Now, my problem is I have used
finish();
for the cancel button, and what I understood is that the 'finish()' will terminate the current running activity.
Once the application is started and if the user clicks the cancel button, the app terminates, but if the user goes to the main screen and comes back to the intro screen and then click cancel the intro screen will exit(Activity responsible for the intro screen).and the main screen appears back.
This forms a continuous loop since the previous Activity (activity opened just before the intro activity) will always appear even if the user clicks the cancel button...
Does anyone have an idea how to terminate more than one activity at a time?
You can use setResult() function in your Intro Activity, and 'catch' it in Main Activity overriding OnActivityResult() function.

how to go on previous screen from current screen in Android app

How do I go to previous screen from current screen in Android app? I know there is a back button on phone, but it takes me to beginning screen of my app and I want my buttons on app to work for going back to previous screen.
Back button indeed takes you to previously seen activity on screen, that launched the current one (not by means of back button). If back button takes you to beggining screen of your app means that navigation to your last activity was done from it. Try launching an activity from another one different from start activity.
What really can be problematic is ending application once at start activity by pressing back button and discovering the application switching to activity that lauched start activity (not by means of back button). In this case you should just call finish() inside onDestroy() listener method of your start activity.

Categories

Resources