My manifest as below:
<activity android:name="SendLauncherActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
I want to get each file’s path.
So I have code as below:
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (imageUris != null) {
for(int i = 0; i < imageUris.size();i++) {
System.out.println("Path " + imageUris.get(i).getPath());
}
}
But I get path such as below:
01-17 18:21:13.350: I/System.out(20564): Path /external/file/15406
How can I modify to get the actual file path?
There might not be an “actual file path”.
If you look, your scheme is probably
content://. This is data served by aContentProvider. There does not have to be a file.You can use
ContentResolverto get anInputStreamfor thisUri, regardless of whether it is a file or something else being streamed to you.