Example usage for android.view MenuItem getItemId

List of usage examples for android.view MenuItem getItemId

Introduction

In this page you can find the example usage for android.view MenuItem getItemId.

Prototype

public int getItemId();

Source Link

Document

Return the identifier for this menu item.

Usage

From source file:com.limewoodmedia.nsdroid.activities.News.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        loadData();//  w ww.  ja v a  2 s.  c om
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.wooi.vibox.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.demo:
        startActivity(new Intent(MainActivity.this, WBAuthActivity.class));
        break;/*from  ww w  .  j  a va 2  s  .co  m*/
    case R.id.open_api:
        startActivity(new Intent(MainActivity.this, WBOpenAPIActivity.class));
        break;
    case R.id.content:
        startActivity(new Intent(MainActivity.this, ContentActivity.class));
        break;
    case R.id.page:
        startActivity(new Intent(MainActivity.this, UserPage.class));
        break;
    case R.id.follow:
        startActivity(new Intent(MainActivity.this, Follow.class));
        break;

    }
    return true;
}

From source file:samples.piggate.com.piggateCompleteExample.Activity_Exchange.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case android.R.id.home:
        goBackActivity(false);/* www .  j  av a 2 s .c  o m*/
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.lingeringsocket.mobflare.Main.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.refresh:
        refresh();//from w  w w .  j  a va  2s. c  om
        return true;
    case R.id.about:
        displayAboutBox();
        return true;
    case R.id.help:
        displayHelpDialog();
        return true;
    case R.id.settings:
        displaySettings();
        return true;
    default:
        return false;
    }
}

From source file:com.manning.androidhacks.hack040.ImageDetailActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Home or "up" navigation
        final Intent intent = new Intent(this, ImageGridActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);//from   w ww  .jav a  2  s. co m
        return true;
    case R.id.clear_cache:
        final ImageCache cache = mImageWorker.getImageCache();
        if (cache != null) {
            mImageWorker.getImageCache().clearCaches();
            // DiskLruCache.clearCache(this, ImageFetcher.HTTP_CACHE_DIR);
            Toast.makeText(this, R.string.clear_cache_complete, Toast.LENGTH_SHORT).show();
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.pansapiens.occyd.MapResults.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent I;/*from   w w  w .j av  a  2 s.co m*/
    switch (item.getItemId()) {
    case 0:
        I = new Intent(this, Search.class);
        break;
    case 1:
        I = new Intent(this, NewPost.class);
        break;
    case 2:
        I = new Intent(this, MapResults.class);
        break;
    case 3:
        startActivity(new Intent(this, Prefs.class));
        return true;
    case 4:
        //showAlert("Menu Item Clicked", "Help", "ok", null, false, null);
        return true;
    default:
        return false;
    }

    startActivity(I);
    this.finish();
    return true;
}

From source file:net.dahanne.android.regalandroid.activity.Start.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent = null;//from   w  ww .j  a v a 2 s . co m
    switch (item.getItemId()) {
    case R.id.settings:
        intent = new Intent(this, Settings.class);
        startActivity(intent);
        break;

    case R.id.about:
        intent = new Intent(this, About.class);
        startActivity(intent);
        break;

    case R.id.clear_cache:
        intent = new Intent(this, Settings.class);
        try {
            FileUtils.getInstance().clearCache(this);
        } catch (IOException e) {
            ShowUtils.getInstance().alertFileProblem(e.getMessage(), this);
        }

        ShowUtils.getInstance().toastCacheSuccessfullyCleared(this);
        break;

    }
    return false;

}

From source file:com.duguang.baseanimation.ui.listivew.listviews.ListViewsMainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_main_github:
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("http://nhaarman.github.io/ListViewAnimations?ref=app"));
        startActivity(intent);//  w  ww  . ja  v a 2  s. c  o  m
        return true;
    case R.id.menu_main_beer:
        buy("beer");
        return true;
    case R.id.menu_main_beer2:
        buy("beer2");
        return true;
    case R.id.menu_main_beer3:
        buy("beer3");
        return true;
    case R.id.menu_main_beer4:
        buy("beer4");
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.android.development.ExceptionBrowser.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle all of the possible menu actions.
    switch (item.getItemId()) {
    case UPLOAD_ID:
        sendBroadcast(new Intent(Checkin.TriggerIntent.ACTION));
        break;/*from www . ja  v  a  2 s  .  c o m*/
    case CLEAR_ID:
        getContentResolver().delete(Checkin.Crashes.CONTENT_URI, null, null);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.javierc.albuquerquenow.SearchMap.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if (item.getItemId() == android.R.id.home) {
        this.finish();
    } else if (item.getItemId() == R.id.action_legalnotices) {
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SearchMap.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();/*from   w  w  w  . j  a  va  2 s  .co m*/

    }
    return super.onOptionsItemSelected(item);
}