Android the next day

Source: Internet
Author: User

1. Start with visible activity

protected void OnCreate (Bundle savedinstancestate) {    
    Super.oncreate (savedinstancestate); The OnCreate () method of the parent class was called.
Setcontentview (R.layout.aty_timeline);   //Set layout file.

}

Hide the title bar: Requestwindowfeature (window.feature_no_title), placed in front of Setcontentview (R.layout.aty_timeline).
2. Layout files

Use of 3.Toast

Toast.maketext (Firstactivity.this,r.string.abc,toast.length_long). Show ();

4. Destruction activities, one sentence.
Finish ();
The use of 5.Intent.
Show + implicit
Show:
Intent i = new Intent (atylogin.this,atytimeline.class);
I.putextra (Config.key_token,token);
StartActivity (i);

Gets the value of the intent pass:
Intent data = Getintent ();
msg = Data.getstringextra (config.key_msg);

Implicit: Add category to your profile and find out what you're looking for in your book.
Intent Intent = new Intent (Intent.action_view);
Intent.setdata (Uri.parse ("http://www.baidu.com"));
StartActivity (Intent);
6. Transfer and return data:
Transfer:
Intent Intent = new Intent (atylogin.this,atytimeline.class);
Startactivityforresult (intent,1);
Receive:
Intent Intent = new Intent ();
Intent.putextra ("Data_return", "hello!");
Setresult (result_ok,intent);
This method is important for passing data to the previous activity,Setresult has two parameters, the first is the return processing result,RESULT_OK , or result_canceled. The second parameter is to pass the intent with the data back.
7. The life cycle of the activity: (Be sure to understand, remember in the heart!) )
OnCreate
OnStart
Onresume
OnPause
OnStop
OnDestroy
Onrestart



  8. Progress bar
Final ProgressDialog PD = Progressdialog.show (Atymessage.this,getresources (). getString (r.string.connecting), Getresources (). getString (R.string.connecting_to_server));
Pd.dismiss ();


Android the next day

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.