Java Code Examples for android.support.v7.app.ActionBar.setStackedBackgroundDrawable()

The following are Jave code examples for showing how to use setStackedBackgroundDrawable() of the android.support.v7.app.ActionBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ChatExchange-old   File: ActionBarHue.java   Source Code and License Vote up 6 votes
public static void setTabBarColorToSharedPrefsValue(AppCompatActivity activity)
{
    if (mSharedPreferences == null)
    {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }

    if (activity != null)
    {
        ActionBar actionBar = activity.getSupportActionBar();

        if (actionBar != null)
        {
            int initialColor = mSharedPreferences.getInt("default_color", activity.getResources().getColor(R.color.colorPrimary));
            actionBar.setStackedBackgroundDrawable(new ColorDrawable(initialColor));

        }
    }
}