Java 如何自定义卸载警报对话框?
我正在开发一个android应用程序。在那个应用程序中,我想卸载我的应用程序 我使用了以下片段Java 如何自定义卸载警报对话框?,java,android,android-alertdialog,uninstallation,Java,Android,Android Alertdialog,Uninstallation,我正在开发一个android应用程序。在那个应用程序中,我想卸载我的应用程序 我使用了以下片段 Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + ((ResolveInfo)list.get(position)).activityInfo.packageName)); c.startActivi
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + ((ResolveInfo)list.get(position)).activityInfo.packageName));
c.startActivity(intent);
卸载警报已打开,卸载完成。但我想自定义卸载警报对话框。如何做到这一点?可以从此代码中尝试
public void btFirst(View v) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
// set title
alertDialogBuilder.setTitle("ALERT>>>>>");
// set dialog message
alertDialogBuilder
.setMessage("UNINSTALL")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
Uri packageURI = Uri.parse("package:com.example.pp");
Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(intent);
//MainActivity.this.finish();
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
我认为这个对话框是Android的一部分。你可能无法更改它。实际上你不需要这样做。这项工作将由android完成。如果我这样做,这意味着当您使用相同的意图片段时,将再次打开默认对话框:-(。如果有任何其他选项,请建议我