我已經在清單中註冊了我的活動android.intent.action.SEND。 現在,在每個應用程序上按SHARE後,我的應用程序彈出 - 這太棒了,但我不明白如何獲取其他應用程序發送給我的參數?如何從android.intent.action.SEND獲取參數
謝謝
我已經在清單中註冊了我的活動android.intent.action.SEND。 現在,在每個應用程序上按SHARE後,我的應用程序彈出 - 這太棒了,但我不明白如何獲取其他應用程序發送給我的參數?如何從android.intent.action.SEND獲取參數
謝謝
您要提取的參數稱爲extras。您可以提取他們這樣說:
Bundle extras = this.getIntent().getExtras();
String[] recipients = (String[]) extras.get(EXTRA_EMAIL);
有幾個演員,你可以從一個ACTION_SEND意圖得到(例如EXTRA_EMAIL,EXTRA_CC,EXTRA_BCC,EXTRA_SUBJECT)。看看在Intent documentation得到一個概述
谷歌提供的所有信息關於這很好解釋:
http://developer.android.com/training/sharing/receive.html 如何設置清單,接收數據,並檢查它。
Intent intent = getIntent();
String name = intent.EXTRA_EMAIL.concat(ACCOUNT_SERVICE);
Toast.makeText(this, name, Toast.LENGTH_LONG).show();