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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:12:15+00:00 2026-05-28T08:12:15+00:00

It updates front activity when I edit or just click ok on any input

  • 0

It updates front activity when I edit or just click ok on any input in preferences screen and than i must first hide front activity. It gives me zero on button and in preferences xml i gave right key and also defaultValue.

So .. scenario: i go to preferences screen, click to edit button text, just click ok, go back, its “0” on button, hide front activity, go back to front activity and theres is the right value.

I hope i included all necessary parts.

    private SharedPreferences prefs;
    private String mobileNumber;
    private static final int MENU_PREFERENCES = Menu.FIRST;
    private static final int SHOW_PREFERENCES = 1;

    private void updateFromPreferences() {
       mobileNumber = prefs.getString("mobileNumber", "0");
    }

    private void refreshAplication(){
       button.setText(mobileNumber);
    }

    @Override
       public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       prefs = PreferenceManager.getDefaultSharedPreferences(this);
       updateFromPreferences();
       refreshAplication();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
        case (MENU_PREFERENCES): {
            Intent i = new Intent(this, Preferences.class);
            startActivityForResult(i, SHOW_PREFERENCES);
            return true;
        }
       }
       return false;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);

      if (requestCode == SHOW_PREFERENCES)
      if (resultCode == Activity.RESULT_OK) {
        updateFromPreferences();
        refreshAplication();
      } 
    }

    public class Preferences extends PreferenceActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.userpreferences);
      }   
    }
  • 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-28T08:12:16+00:00Added an answer on May 28, 2026 at 8:12 am

    Call refreshAplication(); in onResume().

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

Sidebar

Related Questions

Follow on from a previous question One first screen activity I am clicking a
SEE EDIT UPDATES BELOW. Original question has been modified! I have a working window
This is my sistuation A1 = Splash Screen Activity A2 = Main Activity A3
The 'Updates' button on the publish tab of my project has suddenly disabled. I
My macro updates a large spreadsheet with numbers, but it runs very slowly as
There are some updates with .NET 3.0 concerning how to create and use add-ins
My automated deployment system updates a latest version of my site trough subversion. Instead
We perform updates of large text files by writing new records to a temp
When my app updates it needs admin rights and pops the uac prompt up
I have frequent updates to a user table that simply sets the last seen

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.