[ ¼ע ]

android

android(ǿƼ!!!)

2016-03-17 09:29:45 admin һҳ

1

 

Android dvm

Ľ̺

Linux

Ľ

ӦóĽǷΪͬһ

 

DVM

ָ

Dalvik

ÿһ

Android

ӦóԼĽУ

ӵһ

Dalvik

ʵ

ÿһ

DVM

Linux 

еһ̣

˵Ϊͬһ

 

 

2

sim

EF 

ļк

 

sim

ļϵͳԼ淶ҪΪ˺ֻͨѶ

sim

 

ԼIJϵͳ

EF

洢ֻͨѶõ

 

 

3

Ƕʽϵͳڴļ֣к

 

ҳʽʽҳõ

MMU,

ռȼ

 

 

4

ʲôǶʽʵʱϵͳ

, Android 

ϵͳʵʱϵͳ

Ƕʽʵʱϵͳָ¼ݲʱܹܲ㹻ٶԴ

Ľڹ涨ʱ̻֮ԴϵͳӦʵ

ʱЭһеǶʽϵͳҪڹҵơ豸

 

պϵͳӦʱп̵ҪҪʹʵʱϵͳֿɷΪʵʱ

Ӳʵʱ֣

android

ǻ

linux

ں˵ģʵʱ

 

 

5

һĶϢԼռ

byte? 

70(

)

Ӣ

160

ֽ

 

 

6

 

android

еĶļ࣬ǵصʲô

 

֣һ

Tween

һ

Frame

Tween

ʵַʽʹͼ

ƶŴСԼ͸ȵı仯һ

Frame

ͳĶͨ˳

IJкõͼƬʵ֣ƵӰ

 

 

7

handler

Ƶԭ

 

andriod

 

Handler 

 

Looper 

̼߳ͨš

Handler 

Ƚȳԭ

Looper

ض߳ڶ֮Ϣ

(Message Exchange)

 

1

Looper: 

һ߳̿Բһ

Looper

߳

Message Queue(

Ϣ

)

 

 
 
 

2

Handler: 

Թ

Handler

Looper

ͨԱ

push

Ϣ

Message 

Queue

߽

Looper

Message Queue

ȡ

)

Ϣ

 

3

 

Message Queue(

Ϣ

):

̷߳Ϣ

 

4

̣߳

UI thread 

ͨ

main thread

Android

ʱһ

Message 

Queue

 

 

8

˵˵

mvc

ģʽԭ

android

е

 

MVC(Model_view_contraller)

 

ģ

_

ͼ

_

 

MVC

Ӧó

ɡ

Event(

¼

)

Controller

ı

Model

View

ͬʱıߡֻҪ

 

Controller

ı

Models

ݻԣ

View

Զ¡ƵģֻҪ

Controller

ı

View

View

 

DZڵ

Model

лȡˢԼ

 

View

ػڴй¶ĺԾʵ

 

1. View

ˢ

Ҫˢµĵط

,

ʹ

handle.sendmessage

Ϣ

,

Ȼ

handle

getmessage

ִ

invaliate

postinvaliate. 

2. GC

ڴй¶

 

1.

ݿ

cursor

ûйر

 

2.

adapter

ʱ

,

ûʹû

contentview 

listview

Ż

-----

ٴ

view

Ķ

,

ʹ

contentview,

ʹһ̬

Ż

getview

Ĺ

3.Bitmap

ʹʱ

recycle()

ͷڴ

 

4.activity

еĶڴ

activity 

Է

: DDMS==> HEAPSZIE==>dataobject==>[Total Size] 

,

һӭ

,

ܹ

,

Hal

ƪ»漰¼

 

һ

 

Activity

 

 

Activity

һڣ

Activity

 

 

̨

Activity

ϵͳ

 

ô죺

onSaveInstanceState 

 

뱻ãǵͨʹ

 

- Intent 

һ

 

Activity

 

ֻ

 

ƽ̨

 

Ӧóһ

Android

ӦóDZͳһƿصģҲ

˵дӦóڱˣϵͳDzܸıֻѧϰӦ

 

 
 

򵥵˵һΪʲôֻ

 

һӦóʱ

пܴ绰ţ

ûеˣ

ʱ򶼻ᱻжϣ

ȥ绰ĻܣϵͳҲռ̫ԴҪ֤绰ܰ

,

ԴʱҲпܱɵԹ

Activity

Ļ´ʾ

 

Java 

 

?

 

public

 

class

 MyActivity 

extends

 Activity 

protected

 

void

 onCreate(Bundle savedInstanceState); 

protected

 

void

 onStart(); 

protected

 

void

 onResume(); 

protected

 

void

 onPause(); 

protected

 

void

 onStop(); 

protected

 

void

 onDestroy(); 

Լд

Activity

ᰴҪ

 

 

Щ

onCreate

ⲻ˵ģһ

Activity

ĹУDZõ˳

 

onCreate -> onStart ->onResume, 

Activity

ɵʱ˳

onPause -> 

onStop -> onDestroy 

һڣ

 

绰ˣզ죿ֹ£ֹʱ³һ

Activity

ȫô

onPause->onStop 

ָʱ

onStart->onResume 

 

Ӧóһ

Theme

Ϊ

Translucent 

Dialog 

Activity

ôֻ

onPause ,

ָ

 

ʱ

onResume 

 

ϸһ⼸ϵͳʲôԼӦʲô

 

onCreate: 

ﴴ棬һЩݵijʼ

 

onStart: 

һûɼɽ

 

onResume: 

ɺûɽģ

activity 

ջϵͳͨջķʽЩ

Activity

굯ջصһ

Activity) 

onPause: 

 

һǿɼɽģϵͳֹͣ

CPU 

ĵѾ֪

ӦﱣһЩ

,

Ϊʱijȼͣпܱϵͳջء

ﱣݣӦ

 

onResume

ע⣺ʱҪ̣Ϊ

һ

activity

ȵɲ

 

onstop:



Դhttp://www.bozhiyue.com/mianshiti/android/2016/0317/3517.html
һҳ    ط һƪ   һƪ