Android Utililty Methods Activity Set

List of utility methods to do Activity Set

Description

The list of methods to do Activity Set are organized into topic(s).

Method

voidsetDisplayHomeAsUpEnabled(Activity a, boolean enabled)
set Display Home As Up Enabled
a.getActionBar().setDisplayHomeAsUpEnabled(enabled);
booleansetNavigationSelected(Activity activity, ArrayAdapter adapter, String selected)
set Navigation Selected
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
    int setPosition = adapter.getPosition(selected);
    actionBar.setSelectedNavigationItem(setPosition);
    return true;
return false;
booleansetNavigationList(Activity activity, SpinnerAdapter adapter, ActionBar.OnNavigationListener listener)
set Navigation List
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(adapter, listener);
    return true;
return false;
voidsetDisplayHomeAsUpEnabled(Activity activity, boolean b)
set Display Home As Up Enabled
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(b);
voidsetDisplayHomeAsUpEnabled(Activity activity, boolean b)
set Display Home As Up Enabled
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(b);
voidonCreateSetTheme(Activity activity)
Set the theme of the activity, according to the configuration.
switch (cTheme) {
default:
case THEME_DEFAULT:
    break;
case THEME_WHITE:
    activity.setTheme(android.R.style.Theme_Light_NoTitleBar);
    break;
case THEME_BLACK:
...
RelativeLayoutaddView(Activity act, View v, Rect rect)
add View
RelativeLayout rl = new RelativeLayout(act);
ViewGroup fl = (ViewGroup) act.findViewById(android.R.id.content);
fl = (ViewGroup) fl.getChildAt(0);
fl.addView(rl, new FrameLayout.LayoutParams(-1, -1));
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
        rect.width(), rect.height());
params.setMargins(rect.left, rect.top, 0, 0);
rl.addView(v, params);
...
voidenableHardwareAccelerate(Activity activity)
enable Hardware Accelerate
if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
    activity.getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
            WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);