Example usage for android.app Activity DEFAULT_KEYS_DIALER

List of usage examples for android.app Activity DEFAULT_KEYS_DIALER

Introduction

In this page you can find the example usage for android.app Activity DEFAULT_KEYS_DIALER.

Prototype

int DEFAULT_KEYS_DIALER

To view the source code for android.app Activity DEFAULT_KEYS_DIALER.

Click Source Link

Document

Use with #setDefaultKeyMode to launch the dialer during default key handling.

Usage

From source file:edu.cmu.android.restaurant.MapFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    /* menu : camera */
    case Menu.FIRST + 1:
        try {//w  w w. java  2  s.c  o m
            Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
            startActivityForResult(i, Activity.DEFAULT_KEYS_DIALER);
        } catch (Exception e) {
            Log.d("Detail", "Cemara onClick error.");
        } finally {
            if (getActivity().getResources()
                    .getConfiguration().orientation != Configuration.ORIENTATION_PORTRAIT) {
                getActivity().setRequestedOrientation(Configuration.ORIENTATION_PORTRAIT);
            }
        }
        break;

    /* menu : coupon */
    case Menu.FIRST + 2:
        /* display the deal in a dialog */
        findDeal();
        dealDisplay();
        /* audio play */
        MediaPlayer mp = MediaPlayer.create(getActivity(), R.raw.coupon_audio);
        mp.seekTo(0);
        mp.start();
        break;

    /* Menu : about */
    case Menu.FIRST + 3:
        Builder builder3 = new AlertDialog.Builder(getActivity());
        builder3.setTitle("About US");
        builder3.setMessage(ABOUT_CONTENT);
        builder3.setPositiveButton("Return", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
            }
        }).show();
        break;
    }
    return false;

}