String a = "file :/ /" + Environment.getExternalStorageDirectory () getPath () + "/ dcim / Camera /";.
/ / File baseFile = new File (a + "/ dcim/Camera/15.jpg");
/ / Uri uri = Uri.fromFile (baseFile);
/ / Uri uri = Uri.parse (a);
/ / Read the SD card all the pictures
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
String [] projection = {MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATA, MediaStore.Images.Media.SIZE};
"? =" String selection = MediaStore.Images.Media.MIME_TYPE +;
String [] selectionArg = {"image / jpeg"};
Cursor mCursor = this.managedQuery (uri, projection, selection,
selectionArg, MediaStore.Images.Media.DATE_MODIFIED + "desc");
imageList.clear ();
if (mCursor! = null) {
mCursor.moveToFirst ();
while (mCursor.getPosition ()! = mCursor.getCount ()) {
imageMap = new HashMap
imageMap.put (imageID, mCursor.getString (mCursor
. GetColumnIndex (MediaStore.Images.Media._ID)));
imageMap.put (imageName, mCursor.getString (mCursor
. GetColumnIndex (MediaStore.Images.Media.DISPLAY_NAME)));
imageMap.put (
imageInfo,
""
+ (MCursor.getLong (mCursor
. GetColumnIndex (MediaStore.Images.Media.SIZE)) / 1024)
+ "KB");
imageList.add (imageMap);
fileNames.add (mCursor.getString (mCursor
. GetColumnIndex (MediaStore.Images.Media.DATA)));
mCursor.moveToNext ();
}
mCursor.close ();
}
/ / Read the SD card all the pictures
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
The way to get all the pictures no problem, but I changed to the specified folder path SD card but not
String a = "file :/ /" + Environment.getExternalStorageDirectory () getPath () + "/ dcim / Camera /";.
/ / File baseFile = new File (a + "/ dcim/Camera/15.jpg");
/ / Uri uri = Uri.fromFile (baseFile);
Uri uri = Uri.parse (a);
Have tried not work, I do not know of Caesar, please take prompt large<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
In front of a need to add "file :/ /" it?
Reply:
String a = "file :/ /" + Environment.getExternalStorageDirectory () getPath () + "/ DCIM / Camera /";. Attention to the case ~ ~ ~
Reply:
This is the capital DCIM it? ? I use eclipse resource manager looked under the folder is lowercase,
String a = "file :/ /"
+ Environment.getExternalStorageDirectory (). GetPath ()
+ "/ DCIM / Camera /";
Uri uri = Uri.parse (a);
Debugging write reproduce the same image
Reply:
File file = new File ("/ mnt/sdcard/CameraTest/1024_768.jpg");
/ / If (file.exists ()) {
if (file.delete ()) {
Log.e ("del", "delete the file successfully");
loadImageList ();
} Else {
System.out.println ("File not found what you want, oh");
}
/ /} Else {
/ / System.out.println ("File not found what you want, oh");
/ /}
Will android delete () Why Can not delete file file.exists () also returns did not find the file I am looking at the inside just delete this file SD
Reply:
If a folder file.delete () deletes all the files in its directory folder still exists - but if it is not directly delete the folder!
Reply:
Upstairs is very clear, learning
Reply:
Additional information: also need to consider deleting the file permissions problem!
Reply:
File file = new File ("/ mnt/sdcard/CameraTest/1024_768.jpg");
To File file = new File ("/ sdcard/CameraTest/1024_768.jpg"); This trip does not need / mnt
Reply:
I want it to find out how to get the images only from a specific folder, not all of the images. Here is the code I use
/ / Get the image list
private ArrayList
No comments:
Post a Comment