Android development Basics

Source: Internet
Author: User

Http://www.cnblogs.com/xunmengqishi/archive/2012/03/23/2414382.html

As described in the previous articleProgramI have some knowledge about Android. First of all, I suggest learning java. Because Android application-layer development is based on the Java language, I suggest you go to http://developer.android.com/index.htmlandroid developer's official website.

This article introduces an Android app with an interface. The three main components of Android are activty, intent, and services.

Activty: Activity in Chinese translation. Android robots act as a page (panel) activity. Android provides us with an API class, which contains several important methods.

 
Oncreate (bundle savedinstancestate)
 
Onstart () 
 
Onresume ()
 
Onpause ()
 
Onstop ()
 
Ondestroy ().
 
1:Public ClassExampleactivity extends activity {
 
2:
3:Public VoidOncreate (bundle savedinstancestate ){
 
4:Super. oncreate (savedinstancestate );
 
5:// This method is executed during program initialization.
 
6:}
 
7:@ Override
 
8:Protected VoidOnstart (){
 
9:Super. onstart ();
 
10:// This method is executed when the program panel becomes visible
 
11:}
 
12:@ Override
13:Protected VoidOnresume (){
 
14:Super. onresume ();
 
15: // Execute when the program panel is visible (but it is a method to return to the interface again)
 
16:}
 
17:@ Override
 
18:Protected VoidOnpause (){
 
19:Super. onpause ();
 
20:// Another activity is being concentrated (this activity is about "paused ").
 
21:}
 
22:@ Override
23:Protected VoidOnstop (){
 
24:Super. onstop ();
 
25:// The page is no longer visible (now in the "STOPPED" status) and is executed
 
26:}
 
27:@ Override
 
28:Protected VoidOndestroy (){
 
29:Super. ondestroy ();
 
30:// Executed when the page is destroyed
 
31:}
 
32:}
 
The lifecycle diagram of activty is a common question in the android developer's written examination:
 
 
 
 
Method called by each method in activty (panel)
 
 
 
In the kill refers to the unexpected situation of the program, such as whether the system can be forced to shut down when there is no response or the system crashes, in the future, the execution of the next method will be executed after a method is executed.
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.