1 / 6

Android

– 以 Intent  開啟指定的功能頁. Android . Intent. 其 翻釋為 『 意指、意圖 』, 也就是 『 我 想要 …』 的意思 這個功能常用於切換頁面 (Activity) 時使用 , 但除了切換頁面外 , 也可執行於其它的地方 . intent.setClass ( A.this , B.class ); 我想要 從 A 這個地方 , 跳到 B 這個 地方 Intent 不單單只有切換 Activity 的功能而已. 範例 : 開啟網 頁.

svea
Download Presentation

Android

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. – 以 Intent 開啟指定的功能頁 Android

  2. Intent • 其翻釋為 『意指、意圖』, 也就是 『我想要…』 的意思 • 這個功能常用於切換頁面 (Activity) 時使用,但除了切換頁面外, 也可執行於其它的地方. • intent.setClass(A.this, B.class); • 我想要從 A 這個地方, 跳到 B 這個地方 • Intent 不單單只有切換 Activity 的功能而已

  3. 範例: 開啟網頁 button.setOnClickListener(newButton.OnClickListener() {     public void onClick(View view) {         Uri uri = Uri.parse("http://tw.yahoo.com");  Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent);     } }); • 其中看到的 「Intent.ACTION_VIEW」這個動作的意義是指, 該 Intent 會依照所提供的內容不同, 自動開啟對應的程式來檢視內容 • 像上述例子是提供了 Uri 進去, 所以會以 Browser 來開啟指定的網頁

  4. 範例:  開啟地圖 • 若是使用 『geo:』 , 則會以地圖來開啟 button.setOnClickListener(newButton.OnClickListener() {     public void onClick(View view) {         // 台北火車頭 / 高鐵站座標 Uri uri = Uri.parse("geo:25.047192, 121.516981"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent);     } });

  5. intent action.★ • android.intent.action.ALL_APPS • android.intent.action.ANSWER • android.intent.action.ATTACH_DATA • android.intent.action.BUG_REPORT • android.intent.action.CALL • android.intent.action.CALL_BUTTON • android.intent.action.CHOOSER • android.intent.action.CREATE_LIVE_FOLDER • android.intent.action.CREATE_SHORTCUT • android.intent.action.DELETE • android.intent.action.DIAL • android.intent.action.EDIT • android.intent.action.GET_CONTENT • android.intent.action.INSERT • android.intent.action.INSERT_OR_EDIT • android.intent.action.MAIN

  6. intent action.★ • android.intent.action.MEDIA_SEARCH • android.intent.action.PICK • android.intent.action.PICK_ACTIVITY • android.intent.action.RINGTONE_PICKER • android.intent.action.RUN • android.intent.action.SEARCH • android.intent.action.SEARCH_LONG_PRESS • android.intent.action.SEND • android.intent.action.SENDTO • android.intent.action.SET_WALLPAPER • android.intent.action.SYNC • android.intent.action.SYSTEM_TUTORIAL • android.intent.action.VIEW • android.intent.action.VOICE_COMMAND • android.intent.action.WEB_SEARCH

More Related