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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:17:36+00:00 2026-05-29T09:17:36+00:00

I don’t want to be using: onSharedPreferenceChanged Because my Live Wallpaper is reinitialized every

  • 0

I don’t want to be using:

onSharedPreferenceChanged

Because my Live Wallpaper is reinitialized every time something happens with a settings (making it crash, stack overflow!)

Instead I want to be calling the

onDestroy() 

Methed from the settings during the main activity which has ATM:

 SharedPreferences.OnSharedPreferenceChangeListener

I want to do this because it saves on performance & allows me to reinitialise my main class.

How would I go around doing this?

  • 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-29T09:17:37+00:00Added an answer on May 29, 2026 at 9:17 am

    The OnSharedPreferenceChangeListener and OnSharedPreferenceChanged() are SUPPOSED to be called whenever a setting is changed? That’s literally their purpose for being there, so when settings are changed their effects are seen immediately.

    I’m not quite understanding why you want to call onDestroy()? This is only called when an application is going down… so I guess you could simply say:

    this.finish(); // <- Will eventually call onPause(), onDestroy()
    

    If you’re looking to restart your application why not say finish you activity, and start a new one via:

    StartActivity();
    

    Thus you’re completely re-initializing your activities with the new data?

    I would however stick with your OnSharedPreferenceChanged() and just try to find what is actually causing your errors, rather than abstracting the process.

    [Update]

    MainActivity.java

    [...]
    public static void DoSomething(){
    // Do something in main, from any other?
    }
    [...]
    

    PreferenceActivity.java

    @Override
    public void onDestroy(){
    super.onDestroy();
    MainActivity.DoSomething();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't edit CSS very often, and almost every time I need to go
Don't want to sort the entries. using this does not preserve the order as
Don't you hate it when you have class Foobar { public: Something& getSomething(int index)
I don't want PHP errors to display /html, but I want them to display
Don't know if I worded the question right, but basically what I want to
Don't overlook the 'date AND TIME' part though.
Don't know whats exactly going on, but it's definitely killing my time for nothing.
Don't know a whole lot about streams. Why does the first version work using
Don't get me wrong, I want them to get saved. But I always thought
I don't like Jackson. I want to use ajax but with Google Gson. So

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.