Based on your answers and some searching, I get this result (may not comply with Google UI guidelines):
Create an activity that represents the alert
public class DialogMessageActivity extends Activity
Set its theme to Theme.Translucent in AndroidManifest.xml
android:theme="@android:style/Theme.Translucent"
Remove its setContentView function in onCreate
super.onCreate(savedInstanceState);
//setContentView(R.layout.dialog_message);
Add an AlertDialog and call its show from onCreate
super.onCreate(savedInstanceState);
//setContentView(R.layout.dialog_message);
displayAlert(msg);
private void displayAlert(String msg)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(msg).setCancelable(
false).setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
When calling it from any other activity (foreground or background ones, no matter), use the following flag:
Intent intent=new Intent(this,DialogMessageActivity.class);
intent.putExtra(Tags.MESSAGE,msg);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
With these steps you can create a dialog that is seemingly separated from the main application and displayed on its own.