Android ActionBarActivity - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ActionBarActivity class.

This code example shows how to use the following methods:getSupportActionBar, onCreate
package com.haarman.listviewanimations; 
 
import android.os.Bundle; 
import android.support.v7.app.ActionBarActivity; 
import android.view.MenuItem; 
 
public class BaseActivity extends ActionBarActivity { 
 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 
		getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
	} 
	 
	 
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:

7
CodeRank
This code example shows how to use the following methods:getSupportFragmentManager, getIntent, onCreate, setTheme
public class ChannelListActivity extends ActionBarActivity implements IServerSettings { 
    private String mFileName; 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        setTheme(UIUtils.getThemeInt(this)); 
 
        super.onCreate(savedInstanceState); 
 
        mFileName = getIntent().getStringExtra("filename"); 
 
        getSupportFragmentManager().beginTransaction().replace(android.R.id.content, 
                new ChannelListFragment()).commit(); 
    } 
 
    @Override 
    public String getFileName() { 
        return mFileName; 
    } 
 
6
CodeRank
This code example shows how to use the following methods:getSupportFragmentManager, onRestoreInstanceState
        updateFragmentVisibility(); 
    } 
 
    @Override 
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        // Make sure fragments are updated after check box view state is restored. 
        updateFragmentVisibility(); 
    } 
 
    // Update fragment visibility based on current check box state. 
    void updateFragmentVisibility() { 
        // Update top level fragments. 
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        if (mCheckBox1.isChecked()) ft.show(mFragment1);
        else ft.hide(mFragment1);
        if (mCheckBox2.isChecked()) ft.show(mFragment2);
        else ft.hide(mFragment2);
        ft.commit();
 
3
CodeRank
This code example shows how to use the following methods:
/** 
 * This demonstrates the basics of the Action Bar and how it interoperates with the 
 * standard options menu. This demo is for informative purposes only; see ActionBarUsage for 
 * an example of using the Action Bar in a more idiomatic manner. 
 */ 
public class ActionBarMechanics extends ActionBarActivity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        // The Action Bar is a window feature. The feature must be requested 
        // before setting a content view. Normally this is set automatically 
        // by your Activity's theme in your manifest. The provided system 
        // theme Theme.WithActionBar enables this for you. Use it as you would 
        // use Theme.NoTitleBar. You can add an Action Bar to your own themes 
        // by adding the element <item name="android:windowActionBar">true</item> 
        // to your style definition. 
        supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); 
    } 
 
5
CodeRank
This code example shows how to use the following methods:getSupportActionBar, getIntent, onCreate, setTitle
 */ 
public abstract class SimpleFragmentActivity extends ActionBarActivity { 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        ActionBar actionBar = getSupportActionBar();
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
         
        if (getIntent().hasExtra("title")) { 
            setTitle(getIntent().getStringExtra("title")); 
        } 
         
        if (savedInstanceState == null) {
            // During initial setup, plug in the details fragment. 
            Fragment fragment = createFragment();
            fragment.setArguments(getIntent().getExtras());
6
CodeRank
This code example shows how to use the following methods:getSupportFragmentManager, getIntent, onCreate
	public static String IDENTIFIER = "constraints";
 
	@Override 
	@SuppressWarnings("unchecked") 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 
		if (savedInstanceState == null) {
			FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
			ft.add(android.R.id.content, ConstraintListFragment.newInstance(
					(ArrayList<Constraint>) getIntent().getExtras().getSerializable(IDENTIFIER)), "list");
			ft.commit();
		} 
	} 
 
	@Override 
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if ((keyCode == KeyEvent.KEYCODE_BACK)) {
			ConstraintListFragment fragment = ((ConstraintListFragment) getSupportFragmentManager().findFragmentByTag("list"));
 
6
CodeRank
This code example shows how to use the following methods:
import android.widget.Toast; 
 
import com.parse.Parse; 
import com.parse.ParseObject; 
 
public class FeedbackActivity extends ActionBarActivity { 
	private EditText mFeedback;
	private Context mContext;
 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_feedback); 
		mContext = this;
		mFeedback = (EditText) findViewById(R.id.suggestion);
 
		Parse.initialize(this, "dzVYrVqqsEVAadpKvzgCGTEMm7LZBpDJOMI6x79t",
				"soirDTgDunAHoPFBoIgpA7EN3gp5KoYF4AflcC3n"); 
 
		getSupportActionBar().setDisplayShowTitleEnabled(false); 
6
CodeRank
This code example shows how to use the following methods:finish, startActivity
		switch (item.getItemId()) {
		case android.R.id.home:
			Intent intent = new Intent(this, MainActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
			                Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
 
			finish(); 
			return true; 
 
		default: 
			return super.onOptionsItemSelected(item);
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:setTabListener, setText
        } 
    } 
 
    protected Tab makeActionBarTab(TabInfo tabInfo) {
        Tab tab = mActionBar.newTab();
        tab.setText(tabInfo.mTitle);
        tab.setTabListener(mAdapter);
        return tab;
    } 
 
    private void notifyChanged() { 
        if (mAdapter != null) {
            mAdapter.notifyDataSetChanged();
        } 
    } 
 
    public void onDestroyView() { 
        mActionBar.removeAllTabs();
        mActionBar.setNavigationMode(mPrevNavigationMode);
    } 
7
CodeRank
This code example shows how to use the following methods:finish, onCreate, startActivity
 */ 
public class SplashActivity extends ActionBarActivity { 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
 
        Intent i = new Intent(this, ArticlesListActivity.class); 
        startActivity(i); 
        finish(); 
    } 
} 
5
CodeRank
See Code Examples for Android ActionBarActivity Methods: