Android Tip 2

Source: Internet
Author: User

In Eclipse, you can right-click open type hierarchy in the menu to obtain the class inheritance relationship.

In the open call hierarchy project, you can find out who called the current function in the project. This helps you understand the "availability" of the current function, especially when reading other people's code.
 

 
Java code
Intent I = new Intent (this, Activity1.class );
I. addFlags (Intent. FLAG_ACTIVITY_REORDER_TO_FRONT );
StartActivity (I );
[Java] Intent I = new Intent (this, Activity1.class );
I. addFlags (Intent. FLAG_ACTIVITY_REORDER_TO_FRONT );
StartActivity (I );
Intent I = new Intent (this, Activity1.class );
I. addFlags (Intent. FLAG_ACTIVITY_REORDER_TO_FRONT );
StartActivity (I );


This method is used to call an Activity. If the Activity is in the stack, it runs its onStart and onResume functions instead of onCreate functions. In this way, the final running status of the Activity can be saved.
 
 
Android custom global variables:
Class MyApp extends Application {

Private String myState;

Public String getState (){
Return myState;
}
Public void setState (String s ){
MyState = s;
}
}

Class Blah extends Activity {

@ Override
Public void onCreate (Bundle B ){
...
MyApp appState = (MyApp) getApplicationContext ());
String state = appState. getState ();
...
}
}

 

From the column of android interests

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.