What you are doing is fundamentally not going to work.  The gallery app is
implemented to sit on top of a content provider (that is the content: URIs);
it is not implemented to sit on top of a file system (that is a file: URI).
 If you stick a file: URI down into it, it will try to do things with it
that can't be done and won't work.

Your two possible choices are probably either to implement your own content
provider that exposes the same media provider schema as the media provider
does but just for the path(s) you are interested in, or to rewrite the
gallery code to operate on a file system instead of a content provider.

(Btw, this is basically the same as giving say an ftp: URI to some code that
does things with http: URIs and expecting it to somehow work.)

Also I looked for your question on StackOverflow and didn't see it.  Did you
tag it with android?

On Fri, Sep 24, 2010 at 10:19 PM, niko001 <[email protected]> wrote:

> [I have asked this question on Stackoverflow, but haven't gotten any
> replies in 2 days]
>
> Hi,
>
> I am using the Gallery3D-Code for a test-app but want it to only
> display images from a sub-folder on the SD, not all of the images that
> are stored on it. To do this, I tried to change
>
> public static final Uri STORAGE_URI =
> Images.Media.EXTERNAL_CONTENT_URI;
>
> to
> public static final String ROOT_DIR =
> Environment.getExternalStorageDirectory().toString() + "/
> mySubDirectory";
> public static final Uri STORAGE_URI = Uri.fromFile(new
> File(ROOT_DIR));
>
> but I guess this is transforming a content://-Uri to a file://-Uri and
> this may be a problem?
>
> In any case, it doesn't work :-(! Instead of just showing images from
> the ROOT_DIR-directory and its sub-directories, it shows no images at
> all ("Gallery empty"). Could anyone point me in the right direction as
> to what I am doing wrong?
>
> Thanks for your help,
> Nick
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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