我已经制定法典,并努力实施这一法典:
class Example extends Dialog {
@Override
public void dismiss() {
super.dismiss();
if (isForceExists != false) {
int id = android.os.Process.myPid();
android.os.Process.killProcess(id);
}
}
}
但是,当我想在离开申请之前举行其他活动,而不是工作(小规模活动)。
class ExampleActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
Example exDialog = new Example();
exDialog.setDismissListener(new OnDismissListener() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Exit Application")
.setMessage("Thank you for using this application, happy nice day ^_^")
.show();
});
}
}
我想在申请退出之前放弃或等待进展,怎么做? 但是,在没有发生事前,这只是强迫离开?
====================================
谢谢你的建议。 首先,我要对我的问题缺乏解释表示歉意。 因此,我的详细问题是如何警惕。 在完成(a)行动之前建立起来?
我想首先搁置警示,或处理这一事件。 此外,还击退了Example Dialog。
@Override
public void onDismiss(DialogInterface dialog) {
// --> I want to hold AlertDialog first, or handling this event.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Exit Application")
.setMessage("Thank you for using this application, happy nice day ^_^")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface subDialog, int which) {
// --> And After show AlertDialog, back event to dismiss
// of Example extends Dialog again.
ExampleDialog.dismiss();
}
}).show();
}
Running AlertDialog, before finishing. And then return back to dismiss and exit application without from Activity class, but exit or finish from method s Example Dialog class.
class Example extends Dialog {
public boolean isForceExists = true;
@Override
public void dismiss() {
super.dismiss();
if (isForceExists != false) {
int id = android.os.Process.myPid();
android.os.Process.killProcess(id);
}
}
}