Tuesday, February 11, 2014

How to call system camera pictures saved in the specified folder


            
If that, I want to achieve user clicks the button to call the camera, taking pictures just after photographs, according to the specified name saved in the specified folder, ask how to achieve ah? I wrote the following code is not saved in the folder I specify, but with the default name stored in the default folder, solved.
Online, there are answers Results posted immediately, thank you!
 
/ / Camera to get pictures, click on the picture to call this method
protected void doTakePhoto () {
try {
PHOTO_DIR.mkdirs () ;/ / create photo storage directory
mCurrentPhotoFile = new File (PHOTO_DIR, getPhotoFileName ()) ;/ / photo files according to the new naming
final Intent intent = getTakePickIntent (mCurrentPhotoFile);
startActivityForResult (intent, CAMERA_WITH_DATA);
} Catch (ActivityNotFoundException e) {
. Toast.makeText (this, "e =" + e, Toast.LENGTH_LONG) show ();
}
}

public static Intent getTakePickIntent (File f) {
Intent intent = new Intent (MediaStore.ACTION_IMAGE_CAPTURE, null);
Uri u = Uri.fromFile (f);
intent.putExtra (MediaStore.EXTRA_OUTPUT, u);
return intent;
}
/ / Use the current time to get the picture naming
private String getPhotoFileName () {
Date date = new Date (System.currentTimeMillis ());
SimpleDateFormat dateFormat = new SimpleDateFormat (
"'IMG'_yyyy-MM-dd_HH: mm: ss");
return dateFormat.format (date) + "jpg.";
}

Reply:
Their top one, anyone help? For example, or code ah, thank you

Reply:
Get their own, who I'll just answer the knot points posted
Reply:
What to points, quack

Reply:
LZ can you give me a look of complete code Mody, email dz.simple @ gmail.com thank Kazakhstan
Reply:
Intent intent = new Intent (MediaStore.ACTION_IMAGE_CAPTURE);
File path = new File (mstrPath);
if (! path.exists ())
path.mkdirs ();
mstrFileName = Global.GetTime2 () + ". jpg";
mstrFilePath = mstrPath + "/" + mstrFileName;
Log.e (Global.TAG, mstrFilePath);
File file = new File (mstrFilePath);
Uri uri = Uri.fromFile (file);
intent.putExtra (MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult (intent, 1);

Haha, just back months, allowing you to paste Ha knot
Reply:
The above code simply creates a path with the file name, but did not write the data that way. . .
Reply:
references, 5th Floor fff32165 reply:
Intent intent = new Intent (MediaStore.ACTION_IMAGE_CAPTURE);
File path = new File (mstrPath);
if (! path.exists ())
path.mkdirs ();
mstrFileName = Global.GetTime2 () + ". jpg";
mstrFilePath = ......

Popular use. . . In the validation
Reply:
Louzhu ask, how did you solve it? I encountered the same problem. Panfu!
Reply:
Always saved in the default directory, the problem is how to solve ah. I also encountered trouble issued under the code ah
Reply:
LZ give a source it, I get it working beginner mailbox 573357189@qq.com
Reply:
You're calling the system comes with the camera! He will be the default path to save! Rewrite shooting method can be! I tried!
Reply:
Can I have a look at the source
Reply:
Find code. E-mail yufengliu163@163.com
Reply:
Landlord seeking code. I was in trouble for this storage problem. E-mail 397227822@qq.com, thank you slightly.
Reply:
Code in the following address:
http://download.csdn.net/detail/fire_fire_fire/4317821
Reply:
Do not know if bug, or Rom problem, even if you specify a folder, a copy will be saved in the DCIM, this problem is very tangled. . . .
Reply:
Yes, the cell phone camera default folder to the Act in a dcim, but you can delete it ah
Reply:
I downloaded with this do not understand wow, how to use that code? To put the phone? What is the code
Reply:
I tried it, it seems that there is not standardized naming you try it generated name inside - and: all removed, I will be able to
Reply:
Thank landlord, solved a big problem
Reply:
reference to the 16th floor liudi5649385 reply:
do not know if bug, or Rom problem, even if you specify a folder, a copy will be saved in the DCIM This problem is very tangled. . . .
This is not a bug
Reply:
Strange, CSDN how tie knot that can also reply?
Reply:
How to delete the default directory, the name of the default save different camera may not the same, right? There path? How to obtain and then delete? ?

No comments:

Post a Comment