Is the MediaStore.Images.Media._ID unique?

天涯浪子 提交于 2019-12-08 09:03:38

问题


when I run through the Android Media Gallery like this:

Cursor mCursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,null,null,MediaStore.Images.Media.DEFAULT_SORT_ORDER);
if(mCursor != null){
    mCursor.moveToFirst();
    while(!mCursor.isAfterLast()) {
        Log.d("Picture ID",mCursor.getString(mCursor.getColumnIndex(MediaStore.Images.Media._ID));
        mCursor.moveToNext();
    }
    mCursor.close();
}

is the returned ID unique, also when a picture was deleted? Or reuse Android the ID, when I delete a picture?


回答1:


The Media_ID is always unique but there is no guarantee that once the image is deleted it won't be reused again for a new image.



来源:https://stackoverflow.com/questions/39213304/is-the-mediastore-images-media-id-unique

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!