i know my question is similar of this but i didnt find any ans there, so i thought i should have ask here.
app is running fine if i share image from gallery but dont work if i share image from file manager. let me try to explain in details.
EDIT
i have build an app. basically i want to share some images from gallery or file manager to my app. my app only runs when i choose images from gallery and click on share button then click on my application name. that way i can get images selected by me from gallery. however, i do same thing from file-manager app ( i.e solid explorer , ES file explorer ) i couldn't get any images in my app.
may be i would get any solution here.
here is my Manifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
</application>
and here is MainActivity.xml
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent mIntent = getIntent();
String action = mIntent.getAction();
String type = mIntent.getType();
if(action.equals(Intent.ACTION_SEND) && type != null){
if(type.startsWith("image/")){
Uri mUri = mIntent.getParcelableExtra(Intent.EXTRA_STREAM);
ImageModel imageModel = new ImageModel();
imageModel.setName("Image 1");
imageModel.setUri(mUri);
data.add(imageModel);
}
}
else if(action.equals(Intent.ACTION_SEND_MULTIPLE) && type != null){
ArrayList<Uri> mUris = mIntent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
for(int i=0;i<mUris.size();i++){
ImageModel m = new ImageModel();
m.setName("Image "+ i);
m.setUri(mUris.get((i)));
data.add(m);
}
}
else
{
Toast.makeText(this,"from outside",Toast.LENGTH_SHORT).show();
}
}