Note that there are some explanatory texts on larger screens.

plurals
  1. POActivity and AlertDialog are being launched twice
    primarykey
    data
    text
    <p>I have that <code>AlertDialog</code> that is showing twice, and I have no clue why! The problem doesn't apply only for <code>AlertDialogs</code>; However, it applies for <code>"Activities"</code> as well. </p> <p>Note that i'm facing the problem with Android 4.0.3.However, When I run the application on Android 2.3.6, everything works normally. </p> <p>In order to solve my problem with <code>Activitie</code>s, I have set in the manifest file : <code>android:launchMode="singleInstance"</code> and it worked.</p> <p>However, this cannot be done for <code>AlertDialog</code>s as they do not have any references in the manifest file to set it to <code>singleInstance</code> or something like that. </p> <p>Some people told me to put a <code>BreakPoint</code> in order to check my code after <code>show()</code>. But I do not know how to put a <code>BreakPoint</code> and how to check. </p> <p>EDIT:</p> <p>I am using HoloEverywhere and SherlockActionBar. I do not know how much effect they do have.</p> <pre><code>@Override public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) { switch(item.getItemId()) { case R.id.action_one: alertDialog(); break; case R.id.action_two: Intent i = new Intent(this,Info.class); startActivity(i); overridePendingTransition(0, 0); break; } return super.onOptionsItemSelected(item); } private void alertDialog(){ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("My title"); AlertDialog alert= builder.create(); alert.show(); } </code></pre> <p>in <code>case R.id.action_two</code> it's working fine after setting the <code>launchMode="singleInstance"</code> in the manifest file. However, in <code>case R.id.action_one</code> which launches the <code>AlertDialog</code> it's still opening twice.</p> <pre><code>@Override public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { // TODO Auto-generated method stub com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.action_options, menu); return super.onCreateOptionsMenu(menu); } </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