Java Code Examples for android.view.KeyEvent#KEYCODE_E
The following examples show how to use
android.view.KeyEvent#KEYCODE_E .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoteViewFragment.java From Notepad with Apache License 2.0 | 5 votes |
public void dispatchKeyShortcutEvent(int keyCode) { switch(keyCode){ // CTRL+E: Edit case KeyEvent.KEYCODE_E: Bundle bundle = new Bundle(); bundle.putString("filename", filename); Fragment fragment = new NoteEditFragment(); fragment.setArguments(bundle); getFragmentManager() .beginTransaction() .replace(R.id.noteViewEdit, fragment, "NoteEditFragment") .commit(); break; // CTRL+D: Delete case KeyEvent.KEYCODE_D: // Show delete dialog listener.showDeleteDialog(); break; // CTRL+H: Share case KeyEvent.KEYCODE_H: // Send a share intent Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, contentsOnLoad); shareIntent.setType("text/plain"); // Verify that the intent will resolve to an activity, and send if(shareIntent.resolveActivity(getActivity().getPackageManager()) != null) startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); break; } }