Androidのギャラリーの[共有]ボタンに自分のアプリを追加することに成功しましたので、クリックするとアプリが起動します。私のアプリのどのアクティビティを開始するかを選択できますか? これで「メイン」が起動します。Androidアプリをギャラリーの[共有]ボタンに追加します
.....
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String action = intent.getAction();
// if this is from the share menu
if (Intent.ACTION_SEND.equals(action)) {
if (extras.containsKey(Intent.EXTRA_STREAM)) {
// Get resource path
}
}
とマニフェスト:ここに私のメインクラスのコードです
実際に<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
私は「メイン」を開始した直後に新しいアクティビティを開くことに成功するが、私は直接開くことが好むだろう右のもの おかげ
これは簡単ですか? :)うん、それは働いた!感謝の男 – phcaze
@jaumardちょっとあなたの答えは私を助けますが、私は1つのアクティビティで画像ビューで共有したい画像が欲しいです。これどうやってするの ? –
@AndroidKiller use:Uri imageUri =(Uri)intent.getParcelableExtra(Intent.EXTRA_STREAM);単一のイメージの場合、またはArrayListを使用する場合 imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);複数の画像の場合 –