I have an AlertDialog that needs to be used in several Activities. How can I accomplish this with its own Class? Thank-you for your help!~!
I tried the following and acces it in an Activity w:
Alerts.sdCardMissing();
The class I ‘tried’ to create:
public class Alerts {
public static void sdCardMissing() {
AlertDialog alertDialog = new AlertDialog.Builder(null).create();
alertDialog.setTitle("External Storage State");
alertDialog
.setMessage("Your SD-Card is not mounted! If the device is plugged into a computer via the USB, please disconect the device.");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// this.finish();
}
});
// alertDialog.setIcon(R.drawable.icon);
alertDialog.show();
}
}
Try…
Then call it from the Activity with…