2011-06-03 14 views
1

我已經在清單中註冊了我的活動android.intent.action.SEND。 現在,在每個應用程序上按SHARE後,我的應用程序彈出 - 這太棒了,但我不明白如何獲取其他應用程序發送給我的參數?如何從android.intent.action.SEND獲取參數

謝謝

回答

3

您要提取的參數稱爲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得到一個概述

0
Intent intent = getIntent(); 

String name = intent.EXTRA_EMAIL.concat(ACCOUNT_SERVICE); 

Toast.makeText(this, name, Toast.LENGTH_LONG).show();