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.