2
我有一个AlertDialog需要在几个活动中使用。我如何用自己的类来完成这个任务?感谢您的帮助!〜!One AlertDialog,用于多项活动?
我尝试了以下存取权限,并在它的活动宽:
Alerts.sdCardMissing();
我 '尝试' 创建类:
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();
}
}
Thnx @MisterSquonk !!那样做了。 – CelticParser 2011-04-27 01:24:29
@camelCaser:很高兴能有帮助。 – Squonk 2011-04-27 04:07:05
你知道那些只要意识到答案就是这么简单就可以解决问题的日子吗? <3 SOF – Jacksonkr 2016-02-05 13:54:36