Thanks for your answers!

Joe, adding a 'where'-clause to the content-resolver is a good idea.
Thanks also for your follow-up, I'll give it a go! I know the
Gallery3D-code is probably not the best as an entry-level example on
how to deal with providers and Uris, but I love it's functionality and
it is already 80% of what I'd like to achieve, it just seems that the
modification I'm planning to do is not as easy as I would have
hoped :).

Dianne, I feared as much :-)! I think I'll go with implementing my own
content-provider. Do you know if it would have to be exactly the same
schema as the current media provider, or could I add one or two
columns without messing up the underlying Gallery-methods? I'll just
try it out, it's probably too much of a hypothetical question :).

My question on SO can be found at: 
http://stackoverflow.com/questions/3774436/uri-from-filepath

Thanks,
Nick

On Sep 26, 2:54 am, joebowbeer <[email protected]> wrote:
> A bit more information:
>
> The DATA column in the MediaStore provider contains the file path, and
> it is possible to create a LIKE selection that selects content from a
> specific folder -- using a content: Uri not a file: Uri.
>
> LocalDataSource looks like the place to start.
>
> However, I suggest you start with a simpler example. Gallery3D is not
> easily modified in this way.
>
> On Sep 25, 1:40 am, joebowbeer <[email protected]> wrote:
>
>
>
>
>
>
>
> > The cooliris Gallery3D code?
>
> >http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git
>
> > How is the image cursor created? I assume it's obtained from a
> > MediaStore query. But if you change to a file uri, the MediaStore will
> > no longer handle the query...
>
> > I think you can obtain the desired results with a MediaStore query and
> > the original uri if you add a 'selection' that filters on
> > mySubDirectory:
>
> >   contentResolver.query(uri, null,
> >       MediaColumns.DATA + " like '%/mySubDirectory/%'",
> >       null, null);
>
> > On Sep 24, 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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to