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