Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7882887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:23:29+00:00 2026-06-03T04:23:29+00:00

I have two activities in an android application, each has a button that goes

  • 0

I have two activities in an android application, each has a button that goes to the other activity (by startActivity() method). In the second activity, I have an edit text (URL address bar) and a web view.

So, when I click on the button of activity1 to start activity2, I get activity2 with the web view. Then I type cnn.com (for example) in the address bar and my web view displays the cnn.com web site. After that, I click on the button to go from activity2 to activity1.
If I click again on the button of activity1, I start activity2. But activity2 has just been created, I mean, the edit text and the web view are empty.

What I want is: if I return from activity1 to activity2, I want activity2 to keep the last state: the edit text should keep cnn.com and the web view should keep displaying the CNN web site.
So what I need is not to quit activity2 before starting activity1, but something like just hiding it and starting activity2, so that if I return to it again, I get its last state. (Like when I click on the home button.) How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:23:31+00:00Added an answer on June 3, 2026 at 4:23 am

    Here is a suggestion to solve your problem.

    when you go from Button that is in Activity two and now you are in Activity one make sure that when you move from activity two to one, it should not finish activity two.

    Now when you want to go back to Activity two So you need to call your Activity like this in below.

    Intent mIntent=new Intent(yourActivityOne1.this, YourActivity2.class);
    mIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    mIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    startActivity(mIntent);
    

    so what this code does is it will make Activity to come over first without creating a new instance of activity and you can see that your last loaded website it there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android application that contains two Activities . Activity A has a
I have two application that need to talk to each other. App1 needs to
I have an application that contains two Activities with <intent-filter> <action android:name=android.intent.action.MAIN/> <category android:name=android.intent.category.LAUNCHER/>
I'm trying to write an android application that has two main activities: login screen
I’m working on an android application that currently has two Activities, A and B,
I have an Android Honeycomb application with two activities; the first one has a
I have two activities. In first I come to the second activity from first
Say I have two Activities in an Android application, EditPerson and EditEmployee . It
I have two activities; Home is my first activity and Settings is my second
I'm new to Android. I have two activities. First activity shows selected contact list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.