Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rootView.setFocusableInTouchMode(true);
- rootView.requestFocus();
- rootView.setOnKeyListener(new View.OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (DEBUG) {
- Log.d(TAG, "[onCreateView][keyCode: " + keyCode + " ]");
- }
- if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
- if (DEBUG) {
- Log.d(TAG, "[onCreateView][onKey Back listener work]");
- }
- if (getFragmentManager() != null) {
- getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
- }
- return true;
- }
- return false;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement