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ṩڽյĹ㲥ļ֣
7·
һ
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¶Լݣͨ Ա¶ݽв