当前位置:操作系统 > 安卓/Android >>

Android删除相册得最近拍得一张图片

[java] 
private void deleteLatestPhoto() {  
     String[] projection = new String[] { MediaStore.Images.ImageColumns._ID,  
             MediaStore.Images.ImageColumns.DATE_TAKEN };  
     Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,  
             null, null, MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC");  
     if (cursor != null) {  
         cursor.moveToFirst();  
         ContentResolver cr = mContext.getContentResolver();  
         cr.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,  
                 BaseColumns._ID + "=" + cursor.getString(0), null);  
     }  
 }  
 
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,