[Java]
Public void SystemExit ()
{
AlertDialog exitDialog = new AlertDialog. Builder (SystemBaseActivity. this ).
SetTitle ("prompt ").
SetMessage ("do you want to exit this program? ").
SetPositiveButton ("OK", new DialogInterface. OnClickListener ()
{
@ Override
Public void onClick (DialogInterface dialog, int which)
{
For (int I = 0; I <Global. activityList. size (); I ++)
{
If (Global. activityList. get (I )! = Null)
{
Global. activityList. get (I). finish ();
}
}
// Cancel Broadcast
Intent iRefreshService = new Intent (Intent. ACTION_RUN );
IRefreshService. setClass (sys_Context, BootReceiver. class );
IRefreshService. setAction ("ASYNCREFRESH ");
PendingIntent sender = PendingIntent. getBroadcast (sys_Context, 0, iRefreshService, 0 );
AlarmManager am = (AlarmManager) sys_Context.getSystemService (sys_Context.ALARM_SERVICE );
Am. cancel (sender );
// Exit and stop the service
Intent iRefresh = new Intent (Intent. ACTION_RUN );
IRefresh. setClass (sys_Context, AsyncRefresh. class );
Sys_Context.stopService (iRefresh );
// Clear the notification bar
CommonUtil common = new CommonUtil ();
Common. removeNotification (sys_Context,-1 );
ActivityManager activityManager = (ActivityManager) getSystemService (Context. ACTIVITY_SERVICE );
ActivityManager. restartPackage ("com. LeadingGH. Activity ");
// Log out of the VPN
If (StringUtil. vpnAuth! = Null)
{
StringUtil. vpnAuth. VPNLogOut ();
}
// Exit APK
System. exit (0 );
}
}). SetNegativeButton ("cancel", new DialogInterface. OnClickListener ()
{
@ Override
Public void onClick (DialogInterface dialog, int which)
{
Return;
}
}). Create ();
ExitDialog. show ();
}
Public void SystemExit ()
{
AlertDialog exitDialog = new AlertDialog. Builder (SystemBaseActivity. this ).
SetTitle ("prompt ").
SetMessage ("do you want to exit this program? ").
SetPositiveButton ("OK", new DialogInterface. OnClickListener ()
{
@ Override
Public void onClick (DialogInterface dialog, int which)
{
For (int I = 0; I <Global. activityList. size (); I ++)
{
If (Global. activityList. get (I )! = Null)
{
Global. activityList. get (I). finish ();
}
}
// Cancel Broadcast
Intent iRefreshService = new Intent (Intent. ACTION_RUN );
IRefreshService. setClass (sys_Context, BootReceiver. class );
IRefreshService. setAction ("ASYNCREFRESH ");
PendingIntent sender = PendingIntent. getBroadcast (sys_Context, 0, iRefreshService, 0 );
AlarmManager am = (AlarmManager) sys_Context.getSystemService (sys_Context.ALARM_SERVICE );
Am. cancel (sender );
// Exit and stop the service
Intent iRefresh = new Intent (Intent. ACTION_RUN );
IRefresh. setClass (sys_Context, AsyncRefresh. class );
Sys_Context.stopService (iRefresh );
// Clear the notification bar
CommonUtil common = new CommonUtil ();
Common. removeNotification (sys_Context,-1 );
ActivityManager activityManager = (ActivityManager) getSystemService (Context. ACTIVITY_SERVICE );
ActivityManager. restartPackage ("com. LeadingGH. Activity ");
// Log out of the VPN
If (StringUtil. vpnAuth! = Null)
{
StringUtil. vpnAuth. VPNLogOut ();
}
// Exit APK
System. exit (0 );
}
}). SetNegativeButton ("cancel", new DialogInterface. OnClickListener ()
{
@ Override
Public void onClick (DialogInterface dialog, int which)
{
Return;
}
}). Create ();
ExitDialog. show ();
}