Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid back key does nothing?
    primarykey
    data
    text
    <p>My app consists of one activity. When i press back nothing happens, why is this? I thought it would kill the app. If I press home the app contines in the background as desired. It's just the back button that does nothing. What could I have done to affect this? </p> <p>I have read in the documentation:</p> <pre><code>public void onBackPressed () </code></pre> <p>Called when the activity has <strong>detected the user's press of the back key</strong>. The default implementation simply finishes the <strong>current activity</strong> but you can override this to do whatever you want.</p> <p>I have not overridden this.</p> <p>Here is something that has been mentioned, overriding keys:</p> <pre><code>public boolean dispatchKeyEvent(KeyEvent event) { if (event == null || event.getAction() == KeyEvent.ACTION_UP) { return false; } if(event.getKeyCode() == KeyEvent.KEYCODE_DEL){ mEntry.setOnFocusChangeListener(new OnFocusChangeListener(){ @Override public void onFocusChange(View v,boolean hasFocus){ /* When focus is lost check that the text field * has valid values. */ if (!hasFocus &amp;&amp; !mEntry.getText().toString().trim().equals("")) { mSession.appendToEmulator(cmdLeft, 0, cmdLeft.length); mSession.appendToEmulator(cmdErase, 0, cmdErase.length); Log.d(TAG, "in inner delete"); } else {mEntry.setText(" "); } } }); Log.d(TAG, "in delete in delete in delete in delete"); try { sendOverSerial("\b".getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return super.dispatchKeyEvent(event); }; </code></pre> <p>Another snippet, from onCreate:</p> <pre><code>mEntry = (EditText) findViewById(R.id.term_entry); mEntry.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { /* Ignore enter-key-up events. */ if (event != null &amp;&amp; event.getAction() == KeyEvent.ACTION_UP) { return false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload