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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:38:07+00:00 2026-06-14T05:38:07+00:00

I am trying to use setTheme function which basically set theme based on some

  • 0

I am trying to use setTheme function which basically set theme based on some DB value but the problem is once I have updated DB with theme to be set,I need to finish() the activity for theme settings to be implemented. code being –

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        settingsDBAdapter = new SettingsDBAdapter(this);
        settingsDBAdapter.open();

        setSettingsTheme();  <<------THIS LINE WILL SET THEME
        setContentView(R.layout.layout_task_manager);

        quickAddButton = (Button) findViewById(R.id.QuickAddButtonId);
        quickAddTaskText = (EditText) findViewById(R.id.QuickAddEditTextId);

        mDBHelper = new TasksDBAdapter(this); 
        mDBHelper.open();


        fillData();
        //code to create long press on any list item and calls onCreateContextMenu method
        registerForContextMenu(getListView());
        registerButtonListenersAndSetDefaultText();


    }

public void setSettingsTheme(){
        String currentTheme = settingsDBAdapter.fetchThemeSettings("theme");
        Log.i(TAG,"settingsDBAdapter + currentTheme-->" + settingsDBAdapter + currentTheme);
        //setTheme(R.style.HoloTheme);
        if(currentTheme.trim().equalsIgnoreCase("holo")){
            Log.i(TAG, "in holo<<<<<<<<");
            setTheme(R.style.HoloTheme);
        }else if(currentTheme.trim().equalsIgnoreCase("hololight")){
            Log.i(TAG, "in hololight<<<<<<<");
            setTheme(R.style.HoloLightTheme);
        }else{
            Log.i(TAG, "iin else<<<<<<<");
            setTheme(R.style.HoloTheme);
        }
    }

I have also tried calling setSettingsTheme() function after overriding onResume() function still of no use.Log.i present in setSettingsTheme() function gives proper value always.
Can anyone please help me in my understanding. Thanks in advance,Kaushik

  • 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-14T05:38:08+00:00Added an answer on June 14, 2026 at 5:38 am

    The documentation for ContextThemeWrapper.setTheme(int) says:

    Set the base theme for this context. Note that this should be called
    before any views are instantiated in the Context (for example before
    calling setContentView(View) or inflate(int, ViewGroup)).

    The Theme attributes are read in the Views constructors, so after changing the theme you’ll want to recreate the UI. You can call finish() and then startActivity(getIntent()) in your Activity to restart it, or have to code a way to rebuild each and every View object.

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

Sidebar

Related Questions

I am trying use Thread but i have some problem (I am beginner at
I have been trying use the edit_post_link() function to contain an image. All of
Im trying use a Java annotation in a Groovy class but have trouble to
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying use javascript regular expressions to do some matching and I found
trying to use the beforeSave hook with some server side validation and throwing a
I am trying use filehelpers class builder but I am kinda confused on what
I am trying use a javascript function while passing php variables in it. 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.