"Android Learning" "Android Development video tutorial" second quarter notes (not finished)

Source: Internet
Author: User

Video Address:http://study.163.com/course/courseMain.htm?courseId=207001

classActivitylife cycle (i)

1 , how to add New in an app Activity

First step: Add a Activity sub-class (New class , Inherit Activity , adding onCreate method)

Right-click Sourse inside the Override/implement Methods can be automatically added onCreate method.

Step two: in res/layout/ add a layout file below XML

step three: in the new Activity inside the binding layout file

Fourth step: In the main configuration file Androidmanifest.xml in the configuration Activity

Direct imitation of the system automatically generated the write on the line, note <intent-filter></intent-filter> is to declare the main Activity . label is the top tag on the app page.

2 , start Activity

This can be done from mainactivity Jump to newactivity .

3 , Back Stack

Recycle stack, each time is displayed on the top of the stack Activity .

classActivitylife cycle (ii)

1 , Activity The life cycle

to from Activity : A to the Activity : B For example, call the following--

Open A :

A.oncreate A.onstart A.onresume

Click A to jump to the button in the B :

A.onpause b.oncreate B.onstart B.onresume a.onstop

Click the Back button, B to from Back Stack Eject and destroy the

B.onpause a.onrestart a.onstart a.onresume b.onstop B.ondestroy

classActivitylife cycle (iii)

1 , Activity the state of the object

( 1 ) resumed : Activity The object is in a running state;

( 2 ) Paused : Another Activity in the previous paragraph, but this Activity also visible;

( 3 ) Stopped : Another Activity located in the front section, completely obscuring the Activity ;

2 , paired life-cycle functions

OnStart OnStop

Onresume OnPause

Oncreat OnDestroy

classIntentObject Preliminary

1 , using Intent Object Passing Data steps:

The first step: activity:a generated in Intent Object

follow the previous build Activity the method.

Step Two: Use PutExtra () to Intent Object Store Data

There are a few points to note:

( 1 You must add the package name by annotating the key value.

( 2 ) PutExtra () The method is overloaded and can be selected as needed, but the structure is a key - values.

step three: in activity:b Use Getxxxextra () series from Intent object to take out data

There are a few points to note:

( 1 Span style= "font-size:medium;" >) where getstringextra if boolean getbooleanextra And so on, you can find it yourself.

( 2 some can have default values, such as Getintextra There are two parameters, the first is the key name, and the second is the default value, which means that if the key value does not exist, the default value is used.

classAndroidAmong the threads

1 , in UI cannot be modified outside the thread UI the. So who creates the view who can go and modify it. Unless a few of the more special setprogress () methods such as ProgressBar , and so on, most are not allowed.

2 ,

Main thread: Mainthread

In an application, the main thread is used to get the user's input and the results of the operation feedback to the user, so the main thread is not blocked, blocking will appear occasionally, the phone will appear, "program stops Responding", is blocked, need to wait.

Other Threads: Workthread

for some that might be blocking, such as large file reads, it must be placed in Workthread the. (As with the Java multithreaded implementation).

so the question is , Workthread and the Mainthread How to communicate, will be spoken in the future.

Android Learning, Android Development video tutorial, second quarter notes (not to be continued)

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.