I'm trying to make the gallery app share images to my app, the problem is that I don't know how to get the image data sent to me by the gallery. I assumed that I may found the data in the method .getData() but it returns null
this is my intent-filter
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.VIEW"/>
<data android:mimeType="image/*"/>
<category android:name="android.intent.category.default"/>
</intent-filter>
and here is my code in MainActivity
Intent data = getIntent(); //get the intent that starts this activity, in this case: gallery intent
if(data != null){
Uri uri = data.getData();
//set the image view: the problem is: uri is always null
imageView.setImageURI(uri);
}
if the method getData() is not what I want, then how can I get the image that meant to be shared with my app?