Details about Android exit animation ads without errors

Source: Internet
Author: User

-------- 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.