Note that there are some explanatory texts on larger screens.

plurals
  1. POHome button Android 3.0, 4.0
    primarykey
    data
    text
    <p>I have an application in android that includes a application home page. I override the hardware Home button to go back to the application home page for API level 10 or less.</p> <p>My application works fine on Android version 3.0 and 4.0. The problem is overriding the Home button. I found a discussion ( <a href="https://stackoverflow.com/questions/10077675/disable-home-button-in-android-ics-4-0">Disable Home Button in Android ICS (4.0)</a> ) which includes a method to implement a home screen somehow. It is suggested by @Chalaman.</p> <p>I did not get the point yet. Is there any one that can help me more by providing some codes?</p> <p>when we use :</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.HOME" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; </code></pre> <p>in the manifest file, a dialog pops up when we click on the home button. It includes the home phone page icon and application icon. we can make a choice. If we select the application icon, we stay in the application. The problem is we stay also in the same activity. How can I go to another activity (home page of my application)?</p> <p>We can to it in API level 10 or less:</p> <pre><code>@Override public void onAttachedToWindow() { if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.HONEYCOMB) this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_HOME: loadStartPage(); break; } return super.onKeyDown(keyCode, event); } private void loadStartPage() { Intent intent = new Intent(getApplicationContext(), StartActivity.class); intent.putExtra("user", user); intent.putExtra("user_id", user_id); intent.putExtra("server", server); intent.putExtra("password", password); main_activity.startActivity(intent); } </code></pre> <p>How to Load Start Page in API level 11 or greater?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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