I think I can help with the part about reading the file.

My intent and startActivity code looks similar:
          Intent i = new Intent(Intent.ACTION_GET_CONTENT);
          i.setType("image/*");
          startActivityForResult(i,4);

The result is passed in onActivityResult as the intent:
onActivityResult  (int requestCode, int resultCode, Intent data)

To turn that Intent data into a file that I can read, I make it into an
AssetFileDescriptor with this line:

                  AssetFileDescriptor thePhoto =
getContentResolver().openAssetFileDescriptor(data.getData(), "r");

Perhaps there are other ways to do this, but I worked this out via the
documentation and it works for me.
Once you have the AssetFileDescriptor, you can create an inputstream and
read the file or an outputstream to write the file.
I'm reading the file so I say: thePhoto.createInputStream()

See
http://developer.android.com/reference/android/content/res/AssetFileDescriptor.html

Carmen
http://www.twitter.com/CarmenDelessio
http://www.talkingandroid.com




On Mon, Sep 14, 2009 at 9:58 PM, malandro95 <[email protected]> wrote:

>
> Hi,
>
> I'm writing an application where images are read from the filesystem
> based on a certain naming scheme and file structure.  To add images to
> the application, I need to be able to add to this file structure.  I
> need to be able to select from existing images and copy the image to
> its new location.
>
> I've set up a chooser, as follows:
>
>     i = new Intent(Intent.ACTION_GET_CONTENT, null);
>     i.setType("image/jpg");
>     startActivityForResult(Intent.createChooser(i, "Select photo"),
> PICK_FROM_FILE);
>
> When I get the result using this line:
>     URI uri = URI.create(outputIntent.getData().toString());
>
> the value of uri looks like this:   content://media/external/images/media/2
>
> How do I transform this into a jpg file?
>
> Thanks!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to