Call new intent after AlertDialog
<p>I try to add AlertDialog to do rename such as below code:</p>

<pre><code>Button b = (Button)findViewById(R.id.btn);
b.setOnClickListener(
    new OnClickListener() {
        @Override
        public void onClick(View v) {
            AlertDialog.Builder renameDialog = new AlertDialog.Builder(AActivity.this);
            renameDialog.setTitle("Rename");
            final EditText newName = new EditText(AActivity.this);
            newName.setText(FilePath[i]);
            renameDialog.setView(newName);
            renameDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface arg0, int arg1) {
                }
            });

            renameDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface arg0, int arg1) {
                }
            });

            renameDialog.show();
        }
    }

    Intent it = new Intent(AActivity.this, BActivity.class);
    it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);  
    startActivity(it); 
    }
});
</code></pre>

<p>But the error occurs.</p>

<pre><code>Activity AActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@2b0278a8 that was originally added here
</code></pre>

<p>It was cause by new Intent start and pause the old one.
But how to avoid it?</p>
