I'm baffled - and I'm sure it's something really easy. I'm trying to
create an application that allows the user to select an image from
their device, add some minor details, and upload it to a server.
I'm getting my Image Uri with this:
startActivityForResult(new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
SELECT_SHOT);
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_SHOT) {
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = data.getData();
Intent intent = new Intent();
intent.setData(selectedImage);
intent.setClass(this,Details.class);
startActivity(intent);
finish();
}
}
}
The Uri being sent is usually something like this:
content://media/external/images/media/4
No matter what I do - I can't seem to get this Uri into a format that
a File opener will like... I'm currently trying to use this:
java.net.URI juri = new java.net.URI(dataToUploadUri.getEncodedPath
());
FileInputStream fis =this.openFileInput(juri);
Every time I run it I get this error:
java.lang.IllegalArgumentException: File /media/external/images/media/
4 contains a path separator.
Any help would be greatly appreciated - I'm sure I'm just a line or
two of code away. :-)
On a side note - if anyone has a suggested method for uploading files
to a remote server please feel free to share them. :-)
Thanks!
-David
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en