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 to understand the "availability" of the current function, especially when readingCodeIs very useful.

Java code
    1. Intent I =NewIntent (This, Activity1.Class);
    2. I. addflags (intent. flag_activity_reorder_to_front );
    3. 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 ();
...
}
}

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