I’m trying to open android’s own camera application from my application.It is working!But i have a problem when i want to get information like,
-Image ID
-Image Display Name
-Image Title
-Image Data
-Image Size
-Image Date Taken
which should be stored at MediaStore.I was successful in getting image’s path.After that, i have to get information like above but when i try to get information , application throws exception.
Partially My Code is something like this:
while(cursor.moveToNext())
{
Date date = new Date(Long.valueOf(cursor.getString(5)));
SimpleDateFormat dateF = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat timeF = new SimpleDateFormat("HH:mm");
imageListInfo.add(
cursor.getString(0) + ";"
+ cursor.getString(1) + ";"
+ cursor.getString(2) + ";"
+ cursor.getString(3) + ";"
+ cursor.getString(4) + ";"
+ dateF.format(date) + ";"
+ timeF.format(date)
);
}
There had been no problem before i captured and saved the photo which from default camera application called from my application.
I think there is one problem that should be solved.It is how can i save the image with its information like capturing the photo without calling from my application?
EDIT:
It is happening when getting id “cursor.getString(0)” code
android.database.StaleDataException: Attempting to access a closed CursorWindow.Most probable cause:
cursor is deactivated prior to calling this method.
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:139)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
at android.database.CursorWrapper.getString(CursorWrapper.java:114)
at com.canberk.data.warehouse.BaseActivity.indexingForImageMediaStore(BaseActivity.java:313)
at com.canberk.data.warehouse.BaseActivity$BackGroundWorker.doInBackground(BaseActivity.java:109)
at com.canberk.data.warehouse.BaseActivity$BackGroundWorker.doInBackground(BaseActivity.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Thanks in Advance
Your stack trace seems self-explantory: you are accessing a closed
CursorfromindexingForImageMediaStore().