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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:45:09+00:00 2026-06-05T16:45:09+00:00

well there are 3 activities say Act1 , Act2 and Act3 . in Act1

  • 0

well there are 3 activities say Act1, Act2 and Act3.

in Act1 there are three buttons say But1, But2 and But3.

if we click any of the 3 three buttons it will end up showing Act2.

in Act2 there is only one button say Done.

my problem is when i click on the button Done in Act2 i should get the information about the button which is clicked in Act1 to show Act2 in a TextView in Act3.

i think i have made it clear..

i just need to know how to pass the information of the button click in Act1 to Act3

should i use bundles or something else? pls help me out with the logic and if possible a sample code? 🙂

  • 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-05T16:45:10+00:00Added an answer on June 5, 2026 at 4:45 pm

    You can use SharedPreferences to store which button was pressed.

       SharedPreferences appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
                    Editor prefsEditor = appSharedPrefs.edit();
    
        Button b1 = (Button) findViewById(R.id.button1);
        b1.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                    prefsEditor.putString("buttonPressed", "Button1");
                    prefsEditor.commit();
    
                    }
                });
    
        Button b2 = (Button) findViewById(R.id.button2);
        b2.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                    prefsEditor.putString("buttonPressed", "Button2");
                    prefsEditor.commit();
    
                    }
                });
    
        Button b3 = (Button) findViewById(R.id.button3);
        b3.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                    prefsEditor.putString("buttonPressed", "Button3");
                    prefsEditor.commit();
    
                    }
                });
    

    And in the Activity in which you want to fetch which button was pressed:

    SharedPreferences appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
    String whichButton = appSharedPrefs.getString("buttonPressed", "");
    if(whichButton.equals("Button1")
     //do something
    if(whichButton.equals("Button2")
     //do something
    if(whichButton.equals("Button3")
     //do something
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any well-known algorithm (or obvious solution) for transforming a list from order
Is there any way I can obfuscate the names of my Android activities? I
Well is there? From everything I've read, it seems like the answer is no,but
It seems to be well-known there is a bug when using JMenuItem.getRootPane(). I read
For each of the modern browsers are there well known hooks I can tie
Is there a well maintained package available in Python for creating and validating HTML
Is there a well-known, portable, good library for C++ process management? I found a
Is there a well-designed method that can run my ruby program from anywhere? I
There are well-known algorithms for cryptography to compute modular exponentiation (a^b)%c (like Right-to-left binary
Rails has the rest autho plugin which works well but is there a solution

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.