《Android移动开发—习?.0 - 百度文库

AActivity BService CReceiver DContentProvider 5BroadcastReceiver˵ȷǣ Aչ㲥Intent

Bһ㲥Intentֻܱһ˴˹㲥BroadcastReceiver C㲥ϵͳݽȼ˳ִн Dȼandroid:priorityֵԽȼ 6Intent ActionΪʾdz

AACTION_VIEW BS ACTION_CALL CACTION_MAIN DACTION_BOOT_COMPLETED

7ʹIntentIntentʱĸû໥ϵ A B C D

8IntentУָˣԺ,IntentԶǿѡ A B C D

ġ

1 ˵ע㲥мַʽԼЩʽкȱ㡣 2 Ҫ˵ϵͳ㲥ʱЩҪʹȨޡ 3 ζ塪Activity

4 ַʽ 5 Activity佻

6 ҪһActivityеõ´һActivityرպ󷵻صӦβ 7 AndroidṩڽյĹ㲥ļ֣

һ

1ڴʱҪ̳ ࡣ

2󶨷ʱҪʵַ

3嵥ļУעʱӦʹõĽΪ 4Ŀʽֱ֣ 5ڽԶ̷ͨʱҪʹ ӿڡ

6 ܹںִ̨гʱҲṩûӦó

7 ʱ񱻴ŷУ ֹͣ񡣵ֹͣʱϵͳ١

8 ʱ񱻴ſͻͨ ӿͨšͻͨ__________رӡͻܰ󶨵ͬһҵǶʱϵͳٷ񣨷Ҫֹͣ

9Threadṩ Կ̣߳ʹThread ָ߳ʱ䡣ʹThread ̷ָ߳ж󣬲̱߳Ϊж״̬ͨΪ booleanͱ̵߳ж

10ÿMessageͨ á

11ԱԴӻӦóͨIntent Androidϵͳ_ Intentݸ

12 ֹͣ ֹͣ ж

1԰󶨷ʽ󣬷ûйϵ

2Ľõĺۡ

3԰󶨷ʽ󣬵治ɼʱͻᱻرա 4ڷпԴʱĺʱ

5AndroidеĴ˲Ҫ嵥ļעᡣ

6ͻ˵unbindService()ɹϵͳonServiceDisconnected() ѡ

1ÿһ񶼻ã

AonCreate() BonStart() ConResume DonStartCommand 2ѡУڰ󶨷صǣ

AbindService() B߹رպر

CʵServiceConnection DʹstopService()رշ 3ServiceActivityĹͬǣ

AɽûӦ BonResume()CԱԶ̵DԶ۽ 4зУServiceڵǣ

AonResume() BonStartCommand() ConCreat() DonDestory()

5ServiceڵonCreate()onStartCommand()˵ȷǣ AServiceѾȺonCreate()onStartcommand() BһʱȺonCreate()onStartcommand() CһʱֻonCreate()

DServiceѾִֻonStart()ִonCreat() 6 ִ߳棨̵߳ж״̬ Asleep() Bjoin() Cwait() Dinterrupt() 7 һֻ߳һǣ

ALooperMessageQueue BMessage CHandler D϶ 8зУServiceĻصǣ

Aonstart() BonStarCommand() ConBind() DonDestory() 9йڷ˵Уȷǣ

Aһֻᴴһ Bһֻһ Cһֻһ Dһж ġ

1Ҫ˵ʹAIDLԶ̷IJ衣 2Ҫ˵Serviceļʽص㡣 3ַ߳

4Handler4ؼá 5δService

6зʱз;ʱؼʲô

8.1ݴ洢

һ

1лǽ״̬תΪ Ĺ̡

2AndroidҪṩ3ļ洢ʽ ɷΪԭʼʽļ͸ʽݵXMLļ

3ͨ£XMLļַʽֱΪ 4SharedPreferencesһĴ洢࣬Ҫڴ洢һЩӦó 5Androidеݴ洢ʽ5Уֱ

6SharedPreferencesӿλandroid.contentУʹ ķʽ洢ݡҪڻbooleans floats ints longs strings

ж

1SharedPreferencesһXMLļMapʽļС 2ļ洢ͨI/OʽԭⲻĴ洢ĵС 3XMLļֻ汾ݣд䡣 4ContentProviderʾṩߣʾеݡ

5ûļSDʱҪ嵥ļȨandroid.permission.WRITE_EXTERNAL_STORAG

ѡ

1ļУָļݿ׷ӵǣ

AMODE_PRIVATE BMODE_WORLD_READBLE CMODE_APPEND DMODE_WORLD_WRITEABLE

2дУڻȡSD·ǣ

AEnvironment.getSD( ) BEnvironment.getExternalStorageState( );

CEnvironment.getSDDirectory( ) DEnvironment.getExternalStorageDirectory( );

3ѡУļ洢ݵ˵ǣ

Aļ洢ʽݵ Bļ洢Խݴ洢SD Cļ洢Խݴ洢ڴ DAndroidֻʹļ洢

4ѡйXMLлͽǣ

ADOMὫXMLļĵʽڴ BлʱҪʹXmlSerializeлXmlSerializer CXmlSerializerstartDocument()дкŵĿʼڵ DXmlSerializersetOutput()ļı뷽ʽ

5Ҫе˽ݷӦó򣬿ʹõǣ Aļ洢 BSharedPreferences CContentProvider DSQLite

6ݿ⣬DDMSͼFile ExplorerУÿļλǣĿ¼ Adata/data/<>/files Bdata/data/<>/shared _prefs Cdata/data/<>/databases Dres/rawres/xml ġ

1ִ洢ʽԵصֱǣ

2Sharedpreferencesļжд

3.ڲ洢ʵļд

4ηres/rawĿ¼µԭʼʽļ

8.2SQLiteݿ

һ

1ListViewֱ֣ 2ݿ⼰ݿ汾Ҫ̳

3SQLiteʱ ʱ

4ҪѯSQLiteݿеϢҪʹ ӿڣʹϺ رա 5ListViewIJֽͨi Բʹʾڽϡ

5SQLiteDatabaseרṩ˶Ӧӡɾ¡ѯIJ 6query()ķֵΪCursor󣬸öбŲѯ

ݼϵƣݼָ롣 ж

1SQLiteݿʹҪرգӰܡ

2ʹListViewʾΪӵʱArrayAdapter

3SQLite֧AndroidAPI֧SQLɾġ 4ʹBaseAdapterListViewʾͨgetView()á 5SQLiteֻ֧NULLINTEGERREALTEXTBLOB5͡ ѡ

1ʹSQLiteݿвѯ󣬱ҪIJǣ

Aرݿ Bֱ˳ CرCursor Dʹquit˳ 2˵ȷǣ

AҪ洢 BҪݰ CҪ洢XML DҪ

3ʹSQLiteOpenHelperһݿⲢԶݿ汾йķ

AgetDatabase() BgetWriteableDatabase() CgetWriteableDatabase() DgetAbleDatabase() 4ڣSQLiteǣ Ashell Bpush Cquit Dkeytool

5йListViewʹõУȷǣ

AҪʹListViewΪListViewʹAdpaterʽ BҪʹListViewòļӦActivity̳ListActivity

CListViewÿһͼּȿʹõIJ֣ҲʹԶIJַʽ DListViewÿһѡʱᴥListViewItemClick¼ ġ

1Ҫ˵SQLiteݿⴴĹ

2Ҫ˵BaseAdapter4󷽷Լǵľ ĸ󷽷ֱǣ

3˵ContentValuesӺ͸еʹã

4˵òѯõѯӦľݼ

8.3ṩ

һ

1ContentProviderƥUirҪʹõ

2ʹݹ۲ʱ Եõݱ仯Ϣ

3ContentProviderṩ˶ɾġķֱΪ 4ContentProvider ݣAndroidͬӦó֮乲ݵĽӿڡ 5ӦóУʹContentProvider¶Լݣͨ Ա¶ݽв

ϵͷ779662525#qq.com(#滻Ϊ@)