T.dog T.dog - 1 year ago 72
Android Question

Set the path of a folder

I'd like to save pictures into a folder what I have created dynamically. I have a container folder which name is "Eskuvo" and inside that I can create new folders. When I open one of them I'd like to take a picture and save it inside that folder. The problem is that no matter how I give the name of the folder the app always save the picture into the "Eskuvo" folder. I copy my code:


public void TakingPictures(){

File photos = new File("/sdcard/Eskuvo/"+ca.copyname+"/");

String file = "/sdcard/Eskuvo/"+ca.copyname+count+".jpg";
File newfile = new File(file);

}catch (IOException e){

Uri outputFileUri = Uri.fromFile(newfile);

Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

getActivity().startActivityForResult(cameraIntent, 0);

I'd like to mention that
is the name of the folder where I'd like to save. I hope you could help me.

Answer Source

This code:


will create files like these:


Use this code:

String file = ca.copyname+count+".jpg";
File newfile = new File(photos, file);

To create a file in newly created folder.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download