Hello,
Many people want this functionality, so do I. This is one of my
attempts. Can anyone guide me where am I going wrong...
I need to get the image URIs of all the images clicked by the camera
when it was running.
The basic logic I apply is this:
1] Before starting the camera, store a time stamp
Date date = new Date();
long milliDate = date.getTime();
2] Then I start the camera
ComponentName camComp = new ComponentName
("com.android.camera", "com.android.camera.Camera");
Intent takePic = new Intent();
takePic.addCategory("android.intent.category.LAUNCHER");
takePic.addFlags(MODE_PRIVATE);
takePic.setAction("android.intent.action.MAIN");
takePic.setComponent(camComp);
startActivityForResult(takePic, CAM_ACTIVITY);
3] And finally, when it returns, I try to find out all the image URIs
which were clicked during this time period i.e. time > milliDate
if(requestCode == CAM_ACTIVITY){
Cursor imgCursor = managedQuery
(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new
String[]{android.provider.MediaStore.Images.Media._ID},
MediaStore.MediaColumns.DATE_ADDED + " > " +
milliDate , null,
null);
if(imgCursor != null){
imgCursor.moveToFirst();
int _IDidx = imgCursor.getColumnIndex
(android.provider.MediaStore.Images.Media._ID);
do{
String _ID = imgCursor.getString(_IDidx);
String content_URI =
MediaStore.Images.Media.EXTERNAL_CONTENT_URI + "/" + _ID;
}while(imgCursor.moveToNext());
}
Some thing is going wrong here and I get
android.database.CursorIndexOutOfBoundsException for the line String
_ID = imgCursor.getString(_IDidx);
Can anyone tell me where I'm going wrong !!
Regards,
Tejas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---