任務(wù)
一個(gè)任務(wù)就是用戶(hù)為了執(zhí)行特定工作而與之交互的activity和Fragment的集合。內(nèi)部存儲(chǔ)使用堆棧的形式,這些activity會(huì)根據(jù)被打開(kāi)的順序被安放在一個(gè)棧(回退棧)中。
進(jìn)程間通信Intent
七大屬性
(1)componentName(2)Action (3)Categroy
(4)Data 存放Url.parse(類(lèi)型名+值)
(5)Type(MIME type)
?。?!注意單獨(dú)設(shè)置data后設(shè)置type會(huì)使data失效,要配合intent.setActionAndType
使用
(6)flag 啟動(dòng)模式
(7)Extra 使用最多,存數(shù)據(jù) Bundle 短信的鍵是sms_body
1.頁(yè)面間跳轉(zhuǎn)
Intent intent = new Intent(頁(yè)面1,頁(yè)面2)<==>
ComponentName componentName = new ComponentName(this,this.getClass());
intent.setComponent(componentName);
2.進(jìn)程間跳轉(zhuǎn)
Intent intent = new Intent(包名,包名.類(lèi)名);//使用非主頁(yè)面無(wú)效需要隱式意圖
》》》》》非主頁(yè)面還需要解決
========================================================
getTaskId 獲取任務(wù)棧id
1.standard
標(biāo)準(zhǔn)模式,默認(rèn)在回退棧頂部重新創(chuàng)建
2.singleTop
頂端有頁(yè)面時(shí),不重新創(chuàng)建Activity,只執(zhí)行
onNewIntent方法
3.singleTask
在任務(wù)棧中只能存在一份,如果有多個(gè)頁(yè)面,會(huì)彈出上面的Activity。
該啟動(dòng)方式一般作為主頁(yè)面
4.singleInstance
跳轉(zhuǎn)后開(kāi)啟新的回退棧,存放跳轉(zhuǎn)后的頁(yè)面