Example usage for android.app ActionBar setDisplayHomeAsUpEnabled

List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled

Introduction

In this page you can find the example usage for android.app ActionBar setDisplayHomeAsUpEnabled.

Prototype

public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);

Source Link

Document

Set whether home should be displayed as an "up" affordance.

Usage

From source file:com.trackmyway.trackmyway.ListingActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listing_activity);
    mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getSupportFragmentManager());
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mDemoCollectionPagerAdapter);

    // listView = (ListView) findViewById(R.id.listView);

    // Defined Array values to show in ListView
    //        String[] values = new String[] { "Android List View",
    //                "Adapter implementation",
    //                "Simple List View In Android",
    //                "Create List View Android",
    //                "Android Example",
    //                "List View Source Code",
    //                "List View Array Adapter",
    //                "Android Example List View"
    //        };/*from   w  ww .j  av  a2  s. co  m*/
    //        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
    //                android.R.layout.simple_list_item_1, android.R.id.text1, values);

    // Assign adapter to ListView
    //listView.setAdapter(adapter);

    //        btnTrack = (Button) findViewById(R.id.btnAddTrack);
    //        btnTrack.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(ListingActivity.this, TrackActivity.class);
    //                startActivity(intent);
    //            }
    //        });

    //        btnTrip = (Button) findViewById(R.id.btnAddTrip);
    //        btnTrip.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(ListingActivity.this, TripActivity.class);
    //                startActivity(intent);
    //            }
    //        });
    //
    //        btnFollow = (Button) findViewById(R.id.btnAddFollow);
    //        btnFollow.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(ListingActivity.this, FollowActivity.class);
    //                startActivity(intent);
    //            }
    //        });
}

From source file:com.zbrown.droidsteal.activities.HijackActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.webview);/*w ww . j a v a  2s  . c om*/
    CookieSyncManager.createInstance(this);

    ActionBar actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.android.mail.browse.EmlViewerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.eml_viewer_activity);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    final Intent intent = getIntent();
    final String action = intent.getAction();
    final String type = intent.getType();
    mAccountUri = intent.getParcelableExtra(EXTRA_ACCOUNT_URI);

    if (savedInstanceState == null) {
        if (Intent.ACTION_VIEW.equals(action) && MimeType.isEmlMimeType(type)) {
            final FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.add(R.id.eml_root, EmlMessageViewFragment.newInstance(intent.getData(), mAccountUri),
                    FRAGMENT_TAG);/*from  www .  j av a  2  s .com*/
            transaction.commit();
        } else {
            LogUtils.wtf(LOG_TAG, "Entered EmlViewerActivity with wrong intent action or type: %s, %s", action,
                    type);
            finish(); // we should not be here. bail out. bail out.
            return;
        }
    } else {
        if (savedInstanceState.containsKey(SAVED_ACCOUNT)) {
            mAccount = savedInstanceState.getParcelable(SAVED_ACCOUNT);
        }
    }

    // Account uri will be null if we launched from outside of the app.
    // So just don't load an account at all.
    if (mAccountUri != null) {
        getLoaderManager().initLoader(ACCOUNT_LOADER, Bundle.EMPTY, mAccountLoadCallbacks);
    }
}

From source file:com.cyanogenmod.settings.device.DisplaySettings.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.viewPager);//  w w w .  j ava  2  s . c  om
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setTitle(R.string.app_name);
    bar.setDisplayHomeAsUpEnabled(true);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), ScreenFragmentActivity.class,
            null);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }
}

From source file:net.lacolaco.smileessence.activity.EditExtractionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(Themes.getTheme(((Application) getApplication()).getThemeIndex()));
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_edit_list);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    initializeViews();//from w w  w  .j a va2s  .  c om
    Logger.debug("EditExtractionWordActivity:onCreate");
}

From source file:net.lacolaco.smileessence.activity.EditTemplateActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(Themes.getTheme(((Application) getApplication()).getThemeIndex()));
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_edit_list);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    initializeViews();//w  w w. jav  a 2 s  .c  o m
    Logger.debug("EditTemplateActivity:onCreate");
}

From source file:com.android.talkback.TalkBackDumpAccessibilityEventActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTitle(getString(R.string.title_activity_dump_a11y_event));

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }/* w  w  w  .j a  va2 s. c o m*/
    TalkBackDumpAccessibilityEventFragment fragment = new TalkBackDumpAccessibilityEventFragment();
    mListener = fragment;
    getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();
}

From source file:com.gmail.emerssso.srbase.ListDailiesActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.list_comments_activity);

    ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.setDisplayHomeAsUpEnabled(true);

    ListView lv = this.getListView();
    lv.setDividerHeight(2);//  w  w w  .  jav  a 2 s.  c om

    Bundle extras = getIntent().getExtras();

    srId = extras.getString(DailyTable.COLUMN_SR_ID);

    fillData();

    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Intent i = new Intent(parent.getContext(), EditDailyActivity.class);
            Uri dayUri = Uri.parse(SRContentProvider.DAILY_CONTENT_URI + "/" + id);
            i.putExtra(SRContentProvider.DAILY_CONTENT_ITEM_TYPE, dayUri);
            startActivity(i);
        }
    });
}

From source file:org.codecyprus.android_client.ui.ActivityCategories.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_categories);

    listView = (ListView) findViewById(R.id.activity_category_list_view);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override//from   www. java  2s  .  com
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final Category category = categories[position];
            final SerializableSession serializableSession = Preferences.getSession(ActivityCategories.this,
                    category.getUUID());
            if (serializableSession != null) {
                new DialogResumeOrClear(ActivityCategories.this, serializableSession, category).show();
            } else {
                final Intent startQuizIntent = new Intent(ActivityCategories.this, ActivityStartQuiz.class);
                startQuizIntent.putExtra(ActivityStartQuiz.EXTRA_CATEGORY, category);
                startActivity(startQuizIntent);
            }
        }
    });

    final ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.setDisplayHomeAsUpEnabled(true);

    progressReceiver = new ProgressReceiver();
}

From source file:com.gmail.emerssso.srbase.ListPartsActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.list_parts_activity);

    ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.setDisplayHomeAsUpEnabled(true);

    ListView lv = this.getListView();
    lv.setDividerHeight(2);/*from   w w w.  j  a  v a  2 s .co  m*/
    lv.setClickable(true);

    Bundle extras = getIntent().getExtras();

    srId = extras.getString(PartTable.COLUMN_SR_ID);

    if (srId == null)
        throw new RuntimeException("srId is null!");

    fillData();

    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Intent i = new Intent(parent.getContext(), EditPartActivity.class);
            Uri partUri = Uri.parse(SRContentProvider.PART_CONTENT_URI + "/" + id);
            i.putExtra(SRContentProvider.PART_CONTENT_ITEM_TYPE, partUri);
            startActivity(i);
        }
    });
}