Enable animation implementation for android apps and enable animation for android apps

Source: Internet
Author: User

Enable animation implementation for android apps and enable animation for android apps
For example, if A. java enables an animation, it then enters B. java.

1. A. java

Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
Log. I ("START Animation", "Start Animation ");
// Remove the title
RequestWindowFeature (Window. FEATURE_NO_TITLE );
// Set full screen
GetWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
WindowManager. LayoutParams. FLAG_FULLSCREEN );

SetContentView (R. layout. activity_start );
// Specifies the animation duration.
New Handler (). postDelayed (new Runnable (){

@ Override
Public void run (){
// TODO Auto-generated method stub
Intent intent = new Intent (StartActivity. this,
MainActivity. class );
StartActivityForResult (intent, 10 );


}
}, 1000*2 );
}



@ Override
Protected void onActivityResult (int requestCode, int resultCode, Intent data ){
// TODO Auto-generated method stub
Log. I ("StartActivity + returned data", requestCode + "");
Super. onActivityResult (requestCode, resultCode, data );
If (resultCode = 20 ){
Finish ();
}
}

2. B. java

@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
// Set the response so that StartActivity () closes itself
SetResult (20 );
SetContentView (R. layout. activity_main );
 


}

// Explanation

1. new Handler (). postDelayed (new Runnable (){...}

Delay intent jump

2. startActivityForResult (intent, 10 );

Parameter: (Intent intent, Int requestCode)

RequestCode is used for later destruction.

3. onActivityResult (int requestCode, int resultCode, Intent data ){

ResultCode: indicates the data returned by B. java. When B. java is started, data is sent.

A. java destroys data by itself.

4. setResult (20 );

B. Data Set in java returned to A. java. A. java destroys the data by itself.




I want to create an android boot animation application and teach you how to do it.

I guess the main author wants to create an animation on the welcome page, and then perform initialization tasks such as loading resources in the background by playing the animation, so that users don't have to wait for a second time. Is that true?
 
How does android achieve the first animation to enter the application interface?

It is like when you call the nth function, the flag is set to true to false after the call; all functions called in the future are false.
Same principle.

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.