Questions tagged [activity-finish]

341 questions
7
votes
5 answers

Android: When to end class with finish()?

I often see examples of classes which end with finish(), but definitely not always. My question is when should you end a class with finish()? And what does it do exactly, what is the difference between ending a class with the back button and ending…
Xander
  • 5,487
  • 14
  • 49
  • 77
7
votes
2 answers

finish() activity twice in android?

Okay say your using a app, and you opened a new activity and then opened another, you can end the activity your on by using finish(); and your back one activity, but how can you go back two activities, all the way back to the first one? I know you…
William L.
  • 3,846
  • 9
  • 53
  • 72
6
votes
2 answers

finish activity in which a pending intent starts

In my app, i created a custom notification that contain a button that show recent apps(instead of home button long press) when user open main activity and press home button to go to home screen then drag the notification drawer and click on the…
6
votes
3 answers

Android, finish() closes application insead of activity

I call an activity for result: private static final int CODE_LOGIN = 0; private static final int CODE_DETAILS = 1; private void callDetailsActivity() { Intent switchToDetailsActivity = new Intent(getApplicationContext(), Details.class); …
degude
  • 365
  • 2
  • 4
  • 10
6
votes
1 answer

Finish All Instance of particular Activity

There can be many activities in application and the last launched activity stay on top of stack and on pressing back it finish the current activity.I have a sequence of Activity and here is the flow .. if we have A,B,C(1),D,C(2)... Activity C(1) and…
Vipin Sahu
  • 1,441
  • 1
  • 18
  • 29
5
votes
3 answers

activity not calling onDestroy() after finish()

I have three activities, let's call them ONE, TWO and THREE. From activity ONE, a button press starts activity TWO. From activity TWO, a button press starts activity THREE. Simple enough. Now, activity THREE requires a bit of data accessible from…
nak5ive
  • 1,963
  • 4
  • 15
  • 21
5
votes
1 answer

How to use the finish() method in Android

As a newcomer to Android development, I would like to learn how to terminate an activity in Android. I have completed one project already and the previous activity functioned properly. Could you please explain how to finish that activity quickly…
Ramakrishna
  • 4,066
  • 16
  • 48
  • 72
5
votes
2 answers

Android clear / finish previous activities except one

In android I have the following path: Activity 1 -> Activity 2 -> Activity 3 -> ... Activity N -> press button ... When the button is pressed I want to Clear/Finish ALL activities from Activity 2 until N and then go to Acitivy X. In other words I…
Panos
  • 7,227
  • 13
  • 60
  • 95
5
votes
1 answer

activity is finishing too slowly

In my activity 'A' I am using timer and media player to play audio. My app is having a Setting activity say activity 'B', for the selection of audio playing modes. I am using startActivityForResult() and sends a resultCode from activity B.…
SS06Dec86
  • 209
  • 4
  • 11
5
votes
3 answers

How to animate on finish() via ActivityOptions in Android?

I'm working on an app that has two activities, Main and Info. The App is started with the MainActivity and when you click a button the InfoActivity slides in from the right side. When you click another button, InfoActivity shall slide out to the…
micha
  • 321
  • 3
  • 16
5
votes
2 answers

android - finish() closes app instead of the activity

I'm a begginer android programmer, and I seem to have a problem: I open new activitys, with Intent newGameIntent = new Intent(actionName); startActivity(newGameIntent); and everythings works fine, the activity opens. but when i call finish() it…
5
votes
3 answers

Finish all activities except one

When i use this method, i go back to the login page, but I can still click the return button and it returns me to the previous activity. why doesn't it close other activities? public void restartApplication() { Intent i =…
124697
  • 22,097
  • 68
  • 188
  • 315
5
votes
4 answers

how to achieve something like "finish" in a non-activity class in android?

This dialog asks whether you want to install some other app...so when onclicked no button it must go back to the previous screen downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { …
Housefly
  • 4,324
  • 11
  • 43
  • 70
4
votes
5 answers

Why is finish() not quitting processing immediately?

Is there any particular situation when it is handy to not quit the Activity immediately after calling finish() ? (in other way, why is this method not quitting the Activity immediately from…
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
4
votes
4 answers

Saving battery life with finish() and explicit Exit buttons?

In my app I'm implementing many finish() methods between activities. Should I be doing this? I think so because I'm helping conserve the user's battery. Is that true? Also, Google apps don't implement an Exit button in their applications. but I see…
Julio Del Valle
  • 381
  • 1
  • 4
  • 17
1 2
3
22 23