In the manifest filter is registered:
<intent-filter> <action android:name="android.intent.action.SEND"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="image/*"/> </intent-filter>
OnCreate:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if( Intent.ACTION_SEND.equals( getIntent().getAction().toString() ) ){ ImageView image = ( ImageView )findViewById( R.id.imageView ); image.setImageURI( ( Uri )getIntent().getExtras().get( Intent.EXTRA_STREAM ) ); } }
But it does not work. Run on Android 4.0. Just open, or open through a sample of possible applications when sending an image - there is no difference. Changed the string
image.setImageURI( ( Uri )getIntent().getExtras().get( Intent.EXTRA_STREAM ) );
On
image.setImageResource( R.drawable.ic_launcher );
And it works accordingly. Those. the question is that I am not pulling the image out of the external flow correctly? If so, how to pull it out correctly?
Thanks for attention.
ACTION_SEND
? NeedACTION_VIEW
- Barmaley