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 6717697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:52:58+00:00 2026-05-26T08:52:58+00:00

In my app I have three activity as Activity 1 Activity 2 Activity 3

  • 0

In my app I have three activity as

  1. Activity 1

  2. Activity 2

  3. Activity 3

How to switch between activities.

So how can this be done?

 public boolean onOptionsItemSelected(MenuItem item)
{   

    switch (item.getItemId()) 
    {
        case R.id.settingOpt:                           
            Intent intent = new Intent(this, SettingsForm.class);
            this.startActivity(intent); 
            this.finish();
        break;         

        case R.id.reminderOpt:                          
            Intent intentR = new Intent(this, ReminderForm.class);
            this.startActivity(intentR);   
        break;

        case R.id.helpOpt:                          
            Intent intentH = new Intent(this, HelpForm.class);
            this.startActivity(intentH);  
            this.finish();
        break;

        case R.id.shareOpt:                             
            Intent share = new Intent(android.content.Intent.ACTION_SEND);
            share.setType("text/plain");
            share.putExtra(Intent.EXTRA_SUBJECT, "Name of the thing to share");
            share.putExtra(Intent.EXTRA_TEXT, "www.gmail.com");
            startActivity(Intent.createChooser(share, "Share LoveCycle's website link with your friends"));
        break;

        default:

        return super.onOptionsItemSelected(item);       
    }

    return true;
}
  • 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-05-26T08:52:59+00:00Added an answer on May 26, 2026 at 8:52 am

    When I click back button from Activity3 I should always went to Activity1,instead of Activity2:

    Use following method on back button press event in Activity3:

    setResult(R.id.common_backToActivity1);
    

    And in Activity2 capture that setResult as follows and close this Activity:

    protected void onActivityResult(int requestCode, int resultCode,Intent data) {
            switch(resultCode){
            case R.id.common_backToActivity1:
                closeActivity();  //Finish Activity2 in this method
                break;  
            }
            super.onActivityResult(requestCode, resultCode, data);
        }
    

    Then you will get directly to Activity1.

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

Sidebar

Related Questions

I have three activities in my android app. First activity is main application screen
Lets say I have three Activities in my App. 1) Signup Activity 2) AccountActivate
Can some one tell me were i am going wrong. i have three activity's
My app has three tabs, A, B, C that have three distinct activities. Tab
I have three activities A->B->C.when i am in B activity i click the home
in my app i have three activities named as Home, SignIn and Add Page.
I have three activities that I can call A, B and C. I want
I have a three-page/Activity setup/configuration piece to my app. I want to have two
I have three activities in my app. I want to keep the screen awake
I have this app which consists of three tabs. The first tab has a

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.