其實谷歌android 英文的api寫的就已經很清楚了,只是中文的人云亦云,不明白的話,還是要去翻看最原始的解釋。
1 四種啓動模式
standard: 每次啓動activity都會產生新的實例。
singleTop:如果activity棧頂已經有這個activity的實例,則不再生成新實例。如果,該實例不在棧頂,則生成新的實例。
singleTask:如果棧內存在該實例,則不論是否位於棧頂,都不會生成新的實例。如果棧內沒有該實例,則生成新的實例。
singleInstance:跟singleTask類似,只是這種模式下,activity存在的task中,只能有這個activity的實例,不存在其他實例。
2 顯示和隱式intent的區別
如谷歌的解釋:http://developer.android.com/reference/android/content/Intent.html
intent用於Activity
, BroadcastReceiver
, or Service。
顯示intent:指明瞭具體的組件,使用setComponent(ComponentName) or setClass(Context, Class)。
隱式intent:沒有指明具體的組件,但是我們需要根據action, type, and category去找到那個合適的組件。而那個組件正好通過IntentFilter包含了所對應的action, type, and category。
3 JVM加載class機制
4 Integer和int區別
int 是基本數據類型,而Integer是int的包裝類,包含了對int數值處理的相關方法。int定義的變量可直接使用,而Integer因爲是類,則需要實例化。
5 ArrayList、Vector和LinkedList
ArrayList:非線程安全;空間不足時,申請大小爲原來的一半。
LinkedList:使用鏈表存儲數據,適合動態的插入和刪除。
Vector:線程同步,因而線程安全。空間不足時,申請大小爲原來的一倍。
6 HashMap和HashTable
HashMap:可存儲空值,非線程安全。
7 android中的mvc
model:處理數據庫操作和網絡操作
view:xml來顯示界面
controller:activity控制
8 android中的xml解析,sax,dom,pull
sax:事件驅動,不需要解析完整個文檔。速度較快。
dom:加載整個文檔到內存,對性能和內存要求較高。
pull:和sax類似。對應節點處理比較好。
9 ListView的優化
使用convertView
10 aidl
可用來跨進程通訊
11 heap和stack
heap(堆):對象實例;stack(棧):基本數據類型、常量、對象的引用地址。
12 wait():釋放鎖
sleep():沒有釋放鎖
13 throws:用在聲明方法時,指出可能拋出的異常。
throw:用在方法中,用來拋出一個異常。程序執行到此處,不再往下執行。
14 sqlite3 是否支持併發
併發,是指同時會有多個用戶或多進程修改數據庫。如果同時修改數據庫,就會出現問題,但是sqlite3是有鎖的。可以保證同時只有一個程序修改數據庫。
進一步學習可參考:sqlite3處理寫併發,SQLITE3的鎖以及事務
15 2種網絡訪問方式(wap)
Android 包含2種 HTTP clients: HttpURLConnection
and Apache HTTP Client. Both support HTTPS, streaming uploads and downloads, configurable timeouts, IPv6 and connection pooling. Apache HTTP client has fewer bugs in Android 2.2 (Froyo) and earlier releases. For Android 2.3 (Gingerbread) and later,HttpURLConnection
is the best choice. Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery. See the Android Developers Blog for a comparison of the two HTTP clients.
HttpClient,是個接口,有些具體的實現子類。
HttpURLConnection,An URLConnection
for HTTP (RFC 2616) used to send and receive data over the web. Data may be of any type and length. This class may be used to send and receive streaming data whose length is not known in advance.
16 aidl 是ipc(跨進程通訊)的一種實現方式
17 BroadcastReceiver的生命週期,BroadcastReceiver 只在執行OnReveice()方法時,是有效的,當方法返回值之後,則不再處於活動狀態。
18