I think my problem is easy to fix for you. I have a service running in the background and starting an Intent which starts an activity, which opens a dialog.
Her is my code from the service:
Intent todialog = new Intent();
todialog.setClass(myService.this, openDialogInSleep.class);
todialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(todialog);
and here is the activity:
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
public class openDialogInSleep extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new AlertDialog.Builder(openDialogInSleep.this)
.setTitle("huhu")
.setNeutralButton("close", null);
}
}
Finally the android manifest:
<activity android:name=".openDialogInSleep" android:theme="@android:style/Theme.Dialog"></activity>
My Problem is, that there is not shown the dialog with the title “huhu” and the button “close”. There is only shown a dialog in a strange form which simply shows a part of my activityname.
What did I forget?
Please help me.
mfg. Alex
You forget to chain in
show()to actually show your dialog.