PendingIntent pendingIntent = PendingIntent.getActivity(context, (int)(Math.random() * 100),MyIntent,PendingIntent.FLAG_UPDATE_CURRENT);
//A PendingIntent will be fired when the notification is clicked. The FLAG_CANCEL_CURRENT flag cancels the pendingintent
mNotification.setLatestEventI
我试图退出我的应用程序触摸后退按钮。我使用了通常的代码,但它只从屏幕上取出应用程序,当我单击右下角的方框(还告诉我它的名称是什么)时,我仍然可以看到运行后台的应用程序,我想把它从系统中完全删除。我试过所有这些程序: finish();和System.exit(0);它们只是将应用程序从前面的地方传递到后台。我想把它从系统中完全删除。
下面是我使用的代码。
@Override
public void onBackPressed() {
new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert
在我的应用程序中,我希望在按后退按钮时退出app,这是我的代码:
@Override
public void onBackPressed() {
new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Exit")
.setMessage("Are you sure you want to exit?")
.setPositiveButton("Yes