Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
279 views
in Technique[技术] by (71.8m points)

Android : Calling the Android Gallery with a Exif Attributes Filter

I would like to pick photos for my app via the Android gallery, however, I only want to be able to pick ones with certain Exif Attributes e.g taken in the last x hours

Is there a way to call the Android gallery via an intent but filter what the user can see/select?

 intent = new Intent(Intent.ACTION_PICK,
 android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
 
 startActivityForResult(intent, IMG_RESULT);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can use the cursor for that

String[] columns = {MediaStore.Images.Media._ID, MediaStore.Images.ImageColumns.DATE_TAKEN};

String orderBy = MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC"; 

cursor = getActivity().managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
        columns,
        null,    
        null,
        orderBy);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...