How to close previous screen in android?

In my application, 4 screens are there. When I switch from one screen to another screen 2 or 3 times. At that time, I want to go to the 1st screen but previous screens are coming. How to close previous screens?


Asked by: Ada314 | Posted: 20-01-2022






Answer 1

Are you mentioning activity as "screen"? If yes, you can call finish() to close the current activity

Answered by: Julia675 | Posted: 21-02-2022



Similar questions

android - Finish any previous activity in stack from current activity?

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity? Any help ? Thanks.


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.


don't go to previous screen in android?

In my application i have two screen. Screen1 and screen2 . If i am in screen2 when i click the back button it shows the screen1. I need to close application at the time of clicking back button in the screen2 . How to do this???


How to go to previous activity if the activity is killed by Android runtime?

I had a problem with an app, i.e., when I am moving to the previous window the control goes to the splash screen of my app because the previous activity is killed by the Android runtime. How do I keep the previous activity alive, or how can I create the activity again and access it from the present activity.


android - how to get font from the previous activity on current activity on canvas

how to get font from the previous activity on current activity on canvas


java - Going Back to Previous Screens

I am new to Android programming and I'm trying to figure out how to go back to a previous screen/activity after opening another screen using startActivity. From all the research I've done, using the finish() method should bring up the previous screen just before the current one; however, in my test program (has four screens with a "next" & "back"button), when pressing the back button, it jumps all the way back to the ...


caching - Android: when in web view: Does the browser cache the previous page?

My question is, when you are in a webView, and you have gone through several pages. You want to go back. Is the last page you have been to cached, so that you would not need internet connection to go back?


Android: Go back to previous activity

I want to do something simple on android app. How is it possible to go back to a previous activity. What code do I need to go back to previous activity


java - How to tell a thread from a previous instance of your activity has finished?

I'm writing a bitmap editor and I'm trying to write an autosave feature. When onPause is called, I write the application state to an autosave file. As this takes between 0.1s and 1.5s, I've been advised this IO operation be performed in a background thread. In the onCreate method of my activity, I check to see if the autosave file exists and, if it does, I open it. Are there any scenarios I have to conside...


java - Switch over tab previous data is coming

I have added a tab bar in my application with four tabs like home stock etc .In that tab bar I have used a nested activity using activity group for all tabs. By default, the home page will show up to the user. If I switch stock tab I am calling stock activity group class from stock activity class. In stock activity I have edittext view with list view. If the users enters 'a' or 'A' value into textwatcher listener I list th...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top