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

  • Home
  • SEARCH
  • 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 7924301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:41:36+00:00 2026-06-03T17:41:36+00:00

I was coding an app I added a preferences menu, and it works, but

  • 0

I was coding an app I added a preferences menu, and it works, but changes happen only when I restart the application,anyone knows how to make changes happen whithout exitting the app???
Thanks in advance 😉

My code ( from main activity):

preferencias = preferenceManager.getDefaultSharedPreferences(TimeToSpeechActivity.this);

OnSharedPreferenceChangeListener listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
      public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
       //nothing here, do I have to put anything?
      }
    };
preferencias.registerOnSharedPreferenceChangeListener(listener);

getPrefs();
changefont(fuente, letra);
if (boole == true) {fontcolors();}

private void getPrefs(){
      fuente = Typeface.createFromAsset(getAssets() , preferencias.getString("elegirfuente", "fonts/Default.ttf"));
     letra = Integer.parseInt(preferencias.getString("fontstyle", "0"));
     bol = preferencias.getBoolean("randomcolors", true);
 }

I have nothing put in preference activity, do i have to put anything?

Also, do I have to edit this?: (SharedPreferences prefs, String key) I ask this because i havent created prefs and key varibles

Thanks in advance!!! 😉

EDIT1: Added preference activity

     public class PantallaOpciones extends PreferenceActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       addPreferencesFromResource(R.xml.opciones);
          }
        }
  • 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-03T17:41:37+00:00Added an answer on June 3, 2026 at 5:41 pm

    Maybe you want to use SharedPreferences like follows:

    String PREFS_NAME = "com.example.sp", PREFS_TEST = "com.examples.sp.test";
    SharedPreferences preferences;
    
    preferences = getSharedPreferences(PREFS_NAME,MODE_PRIVATE);
    // This is how you instantiate a SharedPreference object.
    
    preferences.edit().putString(PREFS_TEST,"TEST").commit();
    // This way the preference is actually modified and saved.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coding an app that works much like Apple's Weather.app: There's a UIPageControl at
I'm coding an application where the client app needs to authenticate with a server
Sorry if this is a simple question, but I've only recently started learn coding
I'm trying to make a menu for my app which I already made. I
I'm currently coding my app that loads images frequently (but not the same images).
I'm coding an app in MSVS 2008, which has a ComboBox control which I
I'm coding an app in Phonegap and I'm trying to extract the video-ID from
I am in the process of coding an app which has to get the
I am coding a small app ,in middle i struck at some point where
I'm coding an android app for parsing sms messages. I need different rules for

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.