How to make dialog to look like ICS theme
Posted
by
Naruto
on Stack Overflow
See other posts from Stack Overflow
or by Naruto
Published on 2014-08-19T04:03:19Z
Indexed on
2014/08/19
4:20 UTC
Read the original article
Hit count: 193
from service i'm creating a dialog via a dummy activity. Here i'm able to see black background, overall the theme of dialog looks like Android V 2.2. My application minimum API level is 8, if i use holo theme it says i need min api level as 14.
Here is the code i used to create dialog. How to get ICS theme dialog.
public class PreviewDialog extends Activity{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Show the popup dialog
showDialog(0);
}
@Override
protected Dialog onCreateDialog(int id)
{
super.onCreateDialog(id);
// Build the dialog
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("ALARM REMINDER");
alert.setMessage("Its time for the alarm ");
alert.setCancelable(false);
alert.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
GoogleTaskPreviewDialog.this.finish();
}
});
// Create and return the dialog
AlertDialog dlg = alert.create();
return dlg;
}
}
MY manifest file entry
<activity android:name="PreviewDialog" android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>
© Stack Overflow or respective owner