Open jbieler opened 7 years ago
PlaybackActivity in PMCADemo handles with photos from MediaLibrary, so take a look there. What is your goal to access photos?
In the long run, it would be nice to have an abstraction that you can query to get the taken photos. But right now, I only the last photo that was taken.
How's that working?
Is Aviindexstore equivalent to the DSC1000 folder?
I think so. Try to use something like this to get last photo:
import com.sony.scalar.media.AvindexContentInfo; import com.sony.scalar.provider.AvindexStore; import android.content.Context; import android.database.Cursor; import android.net.Uri;
public static String getLastImage(Context context) { String imageFile = ""; String imageDate = ""; Uri baseUri = AvindexStore.Images.Media.getContentUri(AvindexStore.Images.Media.EXTERNAL_DEFAULT_MEDIA_ID); final String imageOrderBy = AvindexStore.Images.ImageColumns.CONTENT_CREATED_LOCAL_DATE_TIME + " DESC"; Cursor imageCursor = context.getContentResolver().query(baseUri, AvindexStore.Images.Media.ALL_COLUMNS, null, null, imageOrderBy); if (imageCursor.moveToFirst()) { String imgData = imageCursor.getString(imageCursor.getColumnIndex(AvindexStore.Images.Media.DATA)); AvindexContentInfo infoImage = AvindexStore.Images.Media.getImageInfo(imgData); imageFile = infoImage.getAttribute(AvindexContentInfo.TAG_DCF_TBL_FILE_NAME); // <-- last image filename imageDate = infoImage.getAttribute(AvindexContentInfo.TAG_DATETIME); String filenumber = imageCursor.getString(imageCursor.getColumnIndex(AvindexStore.Images.Media.DCF_FILE_NUMBER)); //<-- photo number imageCursor.close(); //Toast.makeText(context.get.getBaseContext(), "[" + imageFile + "] | [" + imageDate + "]", Toast.LENGTH_SHORT).show(); } return imageFile + ";" +imageDate; }
AvIndexStore is a content provider. Have a look here: https://developer.android.com/guide/topics/providers/content-provider-basics.html
Thank you for the code piece.
Now that I know the filename. How do I access the image data? Do I create a File and read from it?
Will it work with RAW image or only jpegs?
I need the bitmap data...
Does anybody have a knowledge about how to access photos?
I'm looking into PMCA Demo right now, but it's very cryptic :)?
Any other places for working code?