Activity getActionBar - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Activity getActionBar method.

This code example shows how to use the following methods:getActionBar, getFragmentManager
                args = _args;
            } 
        } 
 
        public TabsAdapter(Activity activity, ViewPager pager) {
            super(activity.getFragmentManager());
            mContext = activity;
            mActionBar = activity.getActionBar();
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        } 
 
        public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mActionBar.addTab(tab);
            notifyDataSetChanged(); 
7
CodeRank
This code example shows how to use the following methods:getActionBar, getFragmentManager
                args = _args;
            } 
        } 
 
        public TabsAdapter(Activity activity, ViewPager pager) {
            super(activity.getFragmentManager());
            mContext = activity;
            mActionBar = activity.getActionBar();
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        } 
 
        public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mActionBar.addTab(tab);
            notifyDataSetChanged(); 
7
CodeRank
This code example shows how to use the following methods:getActionBar, getFragmentManager
                args = _args;
            } 
        } 
 
        public TabsAdapter(Activity activity, ViewPager pager) {
            super(activity.getFragmentManager());
            mContext = activity;
            mActionBar = activity.getActionBar();
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        } 
 
        public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mActionBar.addTab(tab);
            notifyDataSetChanged(); 
7
CodeRank
This code example shows how to use the following methods:getActionBar
     * keeping the verifier from rejecting the use of framework classes that 
     * don't exist on older platform versions. 
     */ 
    static class ActionBarCompatImpl { 
        static void setDisplayHomeAsUpEnabled(Activity activity, boolean enable) {
            activity.getActionBar().setDisplayHomeAsUpEnabled(enable);
        } 
    } 
 
    public static void setDisplayHomeAsUpEnabled(Activity activity, boolean enable) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ActionBarCompatImpl.setDisplayHomeAsUpEnabled(activity, enable);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getActionBar
		mActivity = activity;
	} 
 
	@Override 
	public View getCustomView() {
		if (mActivity == null || mActivity.getActionBar() == null) return null;
		return mActivity.getActionBar().getCustomView();
	} 
 
	@Override 
	public int getHeight() { 
		if (mActivity == null || mActivity.getActionBar() == null) return 0;
		return mActivity.getActionBar().getHeight();
	} 
 
	@Override 
	public CharSequence getSubtitle() {
		if (mActivity == null || mActivity.getActionBar() == null) return null;
		return mActivity.getActionBar().getSubtitle();
	} 
6
CodeRank
This code example shows how to use the following methods:getActionBar
	@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
	private static class SetHomeButtonEnabledAccessor { 
 
		private static void setHomeButtonEnabled(final Activity activity, final boolean enabled) {
			if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) return;
			final ActionBar action_bar = activity.getActionBar();
			action_bar.setHomeButtonEnabled(enabled);
		} 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getActionBar, getFragmentManager
                args = _args;
            } 
        } 
 
        public TabsAdapter(Activity activity, ViewPager pager) {
            super(activity.getFragmentManager());
            mContext = activity;
            mActionBar = activity.getActionBar();
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        } 
 
        public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mActionBar.addTab(tab);
            notifyDataSetChanged(); 
6
CodeRank
This code example shows how to use the following methods:getActionBar, getFragmentManager
                args = _args;
            } 
        } 
 
        public TabsAdapter(Activity activity, ViewPager pager) {
            super(activity.getFragmentManager());
            mContext = activity;
            mActionBar = activity.getActionBar();
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
        } 
 
        public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mActionBar.addTab(tab);
            notifyDataSetChanged(); 
6
CodeRank
This code example shows how to use the following methods:getActionBar, getWindow
	 
	@SuppressLint("NewApi") 
	public static void ToggleFullscreen(Activity activity, boolean fullscreen) {
		if(fullscreen) {
			if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
				ActionBar actionBar = activity.getActionBar();
				if(actionBar != null) actionBar.hide();
			} 
			else { 
				activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
			} 
			 
			//activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
			//						  WindowManager.LayoutParams.FLAG_FULLSCREEN); 
			activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
			activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
		} 
		else { 
			activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
			activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

6
CodeRank
This code example shows how to use the following methods:getActionBar
		/** 
		 * @return Context which should be used for inflating the header layout 
		 */ 
		public Context getContextForInflater(Activity activity) {
			if (Build.VERSION.SDK_INT >= 14) {
				return activity.getActionBar().getThemedContext();
			} else { 
				return activity;
			} 
		} 
	} 
 
	public static class Options { 
 
		/** 
		 * EnvironmentDelegate instance which will be used. If null, we will 
		 * create an instance of the default class. 
		 */ 
		public EnvironmentDelegate environmentDelegate = null;
 
6
CodeRank

Related Activity getActionBar Questions & Answers:

Other Activity getActionBar Examples

83:	
84:			// enabling action bar app icon and behaving it as toggle button
85:			getActionBar().setDisplayHomeAsUpEnabled(true);
86:			getActionBar().setHomeButtonEnabled(true);
87:	
-
84:			// enabling action bar app icon and behaving it as toggle button
85:			getActionBar().setDisplayHomeAsUpEnabled(true);
86:			getActionBar().setHomeButtonEnabled(true);
87:	
88:			mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
-
92:			) {
93:				public void onDrawerClosed(View view) {
94:					getActionBar().setTitle(mTitle);
95:					// calling onPrepareOptionsMenu() to show action bar icons
96:					invalidateOptionsMenu();
-
98:	
99:				public void onDrawerOpened(View drawerView) {
100:					getActionBar().setTitle(mDrawerTitle);
101:					// calling onPrepareOptionsMenu() to hide action bar icons
102:					invalidateOptionsMenu();
-
205:		public void setTitle(CharSequence title) {
206:			mTitle = title;
207:			getActionBar().setTitle(mTitle);
208:		}
209:

Read More

59:	
60:			// enabling action bar app icon and behaving it as toggle button
61:			getActionBar().setDisplayHomeAsUpEnabled(true);
62:			getActionBar().setHomeButtonEnabled(true);
63:	
-
60:			// enabling action bar app icon and behaving it as toggle button
61:			getActionBar().setDisplayHomeAsUpEnabled(true);
62:			getActionBar().setHomeButtonEnabled(true);
63:	
64:			mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
-
68:			){
69:				public void onDrawerClosed(View view) {
70:					getActionBar().setTitle(mTitle);
71:					// calling onPrepareOptionsMenu() to show action bar icons
72:					invalidateOptionsMenu();
-
74:	
75:				public void onDrawerOpened(View drawerView) {
76:					getActionBar().setTitle(mDrawerTitle);
77:					// calling onPrepareOptionsMenu() to hide action bar icons
78:					invalidateOptionsMenu();
-
122:		public void setTitle(CharSequence title) {
123:			mTitle = title;
124:			getActionBar().setTitle(mTitle);
125:		}
126:

Read More

31:			setContentView(R.layout.activity_main);
32:	
33:			actionBar = getActionBar();
34:		}
35:

Read More

getActionBar Method Overview
Retrieve a reference to this activity's ActionBar.
See Code Examples for other Android Activity Methods: