-------- Do not add any permissions for AD
@ Override
Public void onBackPressed (){
// TODO Auto-generated method stub
Super. onBackPressed ();
Intent I = new Intent (Intent. ACTION_MAIN );
I. setFlags (Intent. FLAG_ACTIVITY_NEW_TASK );
I. addCategory (Intent. CATEGORY_HOME );
StartActivity (I );
}
------------ TV animation
Public boolean onOptionsItemSelected (MenuItem item ){
// TODO Auto-generated method stub
If (item. getItemId () = 1 ){
AlertDialog. Builder builder = new
Builder (caipiaoActivity. this );
Builder. setTitle ("Lucky 3D, sports color Arrangement Software letter
Information ");
Builder. setMessage (R. string. about );
Builder. create (). show ();
} Else {
MLinearLayout. startAnimation (new
TVOffAnimation ());
New Timer (). schedule (new TimerTask (){
@ Override
Public void run (){
// TODO Auto-generated
Method stub
Android. OS. Process. killProcess (android. OS. Process. myPid ());
}
},1000 );
}
Return true;
}
------------- Return
Public boolean onKeyDown (int keyCode, KeyEvent event)
{
// TODO Auto-generated method stub
// Return
Super. onKeyDown (keyCode, event );
If (keyCode =
KeyEvent. KEYCODE_BACK)
{
New
AlertDialog. Builder (this)
. SetIcon (android. R. drawable. ic_dialog_alert)
. SetTitle (R. string. loginout_title)
. SetMessage (R. string. loginout_msg)
. SetPositiveButton (
R. string. confirm,
New android. content. DialogInterface. OnClickListener ()
{
@ Override
Public void onClick
(DialogInterface dialog,
Int which)
{
// TODO Auto-generated method
Stub
Intent startMain = new Intent (
Intent. ACTION_MAIN );
StartMain. addCategory (Intent. CATEGORY_HOME );
StartMain
. SetFlags (Intent. FLAG_ACTIVITY_NEW_TASK );
StartActivity (startMain );
System. exit (0 );
}
}). SetNegativeButton (R. string. cancel, null)
. Create (). show ();
Return false;
}
Return false;
}
------------- Animation Summary
After the push advertisement is installed, the process is killed and no window is displayed. The animation playing function is disabled.
Delete the return value.
Public void onBackPressed (){
// TODO Auto-generated method stub
AlertDialog. Builder builder = new
Builder (caipiaoActivity. this );
Builder. setTitle ("prompt ");
Builder. setMessage ("do you want to exit the lucky 3D sports color arrangement ?"
");
Builder. setPositiveButton ("OK ",
New
Android. content. DialogInterface. OnClickListener (){
@ Override
Public void onClick
(DialogInterface dialog, int which ){
// TODO Auto-
Generated method stub
MLinearLayout. startAnimation (new TVOffAnimation ());
New Timer
(). Schedule (new TimerTask (){
@ Override
Public
Void run (){
// TODO Auto-generated method stub
Android. OS. Process
. KillProcess (android. OS. Process. myPid ());
}
},1000 );
}
}). SetNegativeButton ("cancel ",
Null );
Builder. create (). show ();
}
------------ Exit and do not add animation AD push installation is normal, direct installation does not appear in the pop-up window
And then automatically turn it back.
Public void onBackPressed (){
// TODO Auto-generated method stub
Super. onBackPressed ();
Intent I = new Intent (Intent. ACTION_MAIN );
I. setFlags (Intent. FLAG_ACTIVITY_NEW_TASK );
I. addCategory (Intent. CATEGORY_HOME );
StartActivity (I );
From the column of gongzibai