[size=large][color=darkred][b]PendingIntent:[/b][/color][/size]
[size=small][color=olive][b]1. 英文釋義:intent,意圖; pending 表示即将發生的事;
2. 作用:PendingIntent這個類用來處理即将發生的事;
3. 例如:在通知Notification中用于頁面跳轉,但不馬上跳轉;
4. 對比:Intent 是及時啟動的,intent随activity消失而消失;PendingIntent可以看作是對intent的包裝,
5. 提示:Intent 一般是用來作Activity、 Service、BroadcastReceiver之間傳遞資料,而Pendingintent,一般用在Notification上,可以了解為延遲執行的intent;
6. 擷取PendingIntent的執行個體:三個靜态方法可以擷取
a) PendingIntent.getBroadcast();
b) PendingIntent.getActivity();
c) PendingIntent.getService();
7. 說明:由于pendingintetn 中,儲存了目前APP 的context,使它賦予外部App一種能力,使得外部APP可以如同目前APP一樣執行pendingintent裡的intetn,就算執行時目前的APP已經不存在了,也能通過存在pendingintent的context照樣執行intent,另外還可以處理intent執行後的操作;經常和alermaner 和notificationmanager一起使用。[/b][/color][/size][/size]
[color=blue][b]主程式入口:[/b][/color][/size]
[size=medium][color=indigo][b]
結合PendingIntent 功能實作牆紙的切換:[/b][/color][/size]