Code example for Activity

Methods: startActivity

0
 
public class ActionBarUtil { 
 
    public static boolean homewardsWith(Activity activity, Intent homeIntent) {
        homeIntent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
        activity.startActivity(homeIntent);
        return true; 
    } 
 
    public static void setPrefixedTitleOn(ActionBar actionBar, CharSequence prefixTitle, CharSequence title) {
        View customView = actionBar.getCustomView();
        ((TextView) customView.findViewById(R.id.prefix_title)).setText(prefixTitle);
        ((TextView) customView.findViewById(R.id.title)).setText(title);
    } 
 
    public static void fixImageTilingOn(ActionBar actionBar) {
        //This is a workaround for http://b.android.com/15340 from http://stackoverflow.com/a/5852198/132047 
        if (Build.VERSION.SDK_INT < ICE_CREAM_SANDWICH) {
            Resources resources = actionBar.getThemedContext().getResources();
            BitmapDrawable bg = (BitmapDrawable) resources.getDrawable(R.drawable.actionbar_background);
            bg.setTileModeXY(REPEAT, REPEAT);