freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

[計算機軟件及應用]android移動應用設計與開發(fā)--第04章-資料下載頁

2024-12-08 02:20本頁面
  

【正文】 Action、 Data和 Category屬性,用于對 Intent進行匹配。 ? 一個 intentfilter中可以添加多個 action子元素,如下所示 : Intent解析 B、 category子元素 注意:與 Action一樣, intentfilter列表中的 Category屬性 不能為空 。Category屬性的 默認值 “ ”是啟動 Activity的默認值,在添加其他 Category屬性值時,該值必須添加,否則也會匹配失敗。 一個 intentfilter中也可以添加多個 category子元素,例如: intentfilter category android:value=/ category android:value=/ intentfilter Intent解析 C、 data子元素 一個 intentfilter中可以包含多個 data子元素,用于指定組件可以執(zhí)行的數(shù)據(jù),例如: intentfilter data android:mimeType=video/mpeg ! MIME類型 , Intent對象和過濾器都可以用“ *”通配符匹配子類型字段,如“ text/*”,“ audio/*”表示任何子類型 android:scheme= android:host= android:path=folder/subfolder/1 android:port=8888/ data android:mimeType=audio/mpeg android:scheme= ! 模式 android:host= ! 主機 android:path=folder/subfolder/2 android:port=8888/ data android:mimeType=audio/mpeg android:scheme= android:host= android:path=folder/subfolder/3 ! 路徑 android:port=8888/ ! 端口 /intentfilter Activity的跳轉 ? 在 Android世界的四大組件 Activity、 BroadcastReceiver、 Service、 Content Provider中,前三個都是通過 Intent來解析進行跳轉的, Intent可以說是 連接這四大組件的重要 橋梁 ? 在使用 Intent進行 Activity之間的跳轉時,我們通常有三種 Intent跳轉方式,即:不帶參數(shù)的跳轉 、 帶參數(shù)的跳轉 以及 帶返回值的跳轉 ( 1)不帶參數(shù)跳轉 Intent intent = new Intent(); (,)。 startActivity(intent); Activity的跳轉 ( 2)帶參數(shù)跳轉 (用 Bundle封裝數(shù)據(jù) ) Intent intent = new Intent(); Bundle bundle = new Bundle(); (Name, kate); (Age, 25); (bundle); (, ); startActivity( intent ); Activity1跳轉到 Activity2之后, Activity2通過 Bundle獲取 Intent傳過來的值,方法如下: Bundle bundle = ().getExtras(); String name = (Name); String age = (Age); Activity的跳轉 ( 3)帶返回值的跳轉 (用 Bundle封裝數(shù)據(jù) ) Intent_intent=newIntent()。 ( , )。 Bundle bundle = new Bundle(); bundle. putString( 參數(shù) , 參數(shù)值 )。 (bundle)。 注:不傳參數(shù)的話 , 可以不加此行代碼 ( intent, 0)。 ? 第一個頁面 傳送參數(shù)值 的代碼如下所示: 注: startActivityForResult(Intent intent, Int requestCode)方法中的參數(shù) requestCode 用于識別第二個頁面?zhèn)骰貋淼闹怠? ? 第二個頁面準備返回數(shù)據(jù)的代碼如下所示: Intent intent = new Intent()。 Bundle bundle = new Bundle(); bundle. putString(參數(shù) , 參數(shù)值 )。 (bundle)。 (,) ; setResult( RESULT_OK, intent)。 這里有 2個參數(shù) (int resultCode, Intent intent) finish()。 Activity的跳轉 ( 3)帶返回值的跳轉 (用 Bundle封裝數(shù)據(jù) ) ? 第一個頁面接收返回值的代碼如下所示: protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode ) { //requestCode為 Activity1的請求標識 //resultCode為回傳的標記 , 在 Activity2中使用的是 RESULT_OK, 所以此處進行選擇 case 0: if( resultCode == RESULT_OK) { Bundle b=()。 //data為 Activity2中回傳的 Intent String str=(參數(shù) )。//str即為回傳的值 參數(shù)值 } break。 default: break。 } } Activity的跳轉 ( 3)帶返回值的跳轉 (用 Bundle封裝數(shù)據(jù) ) ? 第一個頁面接收返回值的代碼如下所示: protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode ) { //requestCode為 Activity1的請求標識 //resultCode為回傳的標記 , 在 Activity2中使用的是 RESULT_OK, 所以此處進行選擇 case 0: if( resultCode == RESULT_OK) { Bundle b=()。 //data為 Activity2中回傳的 Intent String str=(參數(shù) )。//str即為回傳的值 參數(shù)值 } break。 default: break。 } } 第 4章 結束
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1