A Example:
String[] projection = new String[] { Images.ImageColumns._ID, Images.ImageColumns.BUCKET_DISPLAY_NAME, Images.ImageColumns.BUCKET_ID, Images.ImageColumns.DATE_TAKEN, Images.ImageColumns.DESCRIPTION, Images.ImageColumns.IS_PRIVATE, Images.ImageColumns.LATITUDE, Images.ImageColumns.LONGITUDE, Images.ImageColumns.MINI_THUMB_MAGIC, Images.ImageColumns.ORIENTATION, Images.ImageColumns.PICASA_ID, Images.ImageColumns.DATA, Images.ImageColumns.DATE_ADDED, Images.ImageColumns.DATE_MODIFIED, Images.ImageColumns.DISPLAY_NAME, Images.ImageColumns.MIME_TYPE, Images.ImageColumns.SIZE, Images.ImageColumns.TITLE }; // We can use the following query method to query data. //Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null); Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null); int count = cursor.getCount(); System.out.println("count = " + count); for (int i=0; i<count; i++) { cursor.moveToPosition(i); int columnSize = cursor.getColumnCount(); for (int j=0; j<columnsize; j++) { System.out.println("index = " + j + " " + cursor.getColumnName(j) + " = " + cursor.getString(j)); } }
Reference:
沒有留言:
張貼留言