WEB开发网
开发学院手机开发Android 开发 Android删除相册得最近拍得一张图片 阅读

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

 2013-01-07 17:33:22 来源:WEB开发网   
核心提示: private void deleteLatestPhoto() {String[] projection = new String[] { MediaStore.Images.ImageColumns._ID,MediaStore.Images.ImageColumns.DATE_TAKEN };Cursor

  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);
}
}

Tags:Android 删除 相册

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接