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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:12:22+00:00 2026-05-27T22:12:22+00:00

Basically, i’m currently trying to have some buttons on a screen, when they are

  • 0

Basically, i’m currently trying to have some buttons on a screen, when they are clicked it takes the user to a different activity with EditText field and a done button. Once the data is entered and done hit, it goes back and changes the name of the button text. I used this link to help me How to pass EditText to another activity?. the problem im having is once i click on a different button and enter the info for that and return it has forgotten the previous buttons data. I have a string so only the button clicked gets edited so i think it’s not storing data. I’ve spent ages trying different solutions to make it save state but nothing seems to be working.

I am quite new to Android so i’m well aware the solution may be very simple and i’ve just been implementing it wrong.

The code for the Activity with the buttons is like this:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edit);
setupViews();
setupListeners();
mIntentString = savedInstanceState != null ? 
savedInstanceState.getString("myKey"):null;
if(mIntentString == null){
Bundle extras = getIntent().getExtras();
mIntentString = extras != null ? extras.getString("myKey") : "Choose name";
}
if(ActivityController.button == "1"){
button1.setText(mIntentString);
Log.e(button, "button1 being checked");
}

...

@Override
public void onClick(View view){
if (view == button1) {
Intent i = new Intent();
i.setClass(ActivityEdit.this, ActivityEnterInfo.class);
startActivity(i);
}}

...

public void refreshButtons()
{
if(ActivityController.button == "1"){
mIntentString = button1.getText().toString();
Intent intent = new Intent();
intent.putExtra("returnKey",button1.getText().toString());
setResult(RESULT_OK,intent);
}

I hope this all makes sense, I’ve really hit a brick wall with this and need help

  • 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-27T22:12:23+00:00Added an answer on May 27, 2026 at 10:12 pm

    From my understanding, what you want is to save the state of your buttons internally and restore them when you get back.

    You should override onStart() or onPause() in your buttons activity to save the button data in private members, then override onStop() or onResume() and use it to restore your data.

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

Sidebar

Related Questions

Basically I have some code to check a specific directory to see if an
Basically, I have a JTextPane to hold some text which I wish to style.
Basically I need some text like: I have an ice cream cone. You are
Basically I have 2 strings. They are EXACTLY the same string. However, when I
Basically i'm trying to build a comment system. The user looks at a photo
Basically I have two models: User and Godfather. The godfather table has three columns:
Basically I have this server app I built in vc#, and for some reason
Basically I have some sort of third party software running on Windows 7 which
Basically I am trying to restart a service from a php web page. Here
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I

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.