1

I am building an app which requires pictures from camera and gallery from a drop down. I want if the user selects camera option, the image gets saved in this file path -

Android/data/my_pkg_name(com.joey.imageapp)/files/user_avatars/file_name.png.

How do I create the file path and save the image there? Is internal or external storage the best place to store app-images? Thanks.

Anand Rajput
  • 469
  • 1
  • 8
  • 21
  • you can have a nice answer here https://stackoverflow.com/questions/3551821/android-write-to-sd-card-folder – himel Oct 16 '17 at 05:56

2 Answers2

0

use the following code for setting the path and launching camera

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri imageuri = Uri.fromFile(new File("/your path/yourfilename.png"));
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageuri);
startActivityForResult(intent, 1);
Ramees
  • 68
  • 4
  • 16
0

Is internal or external storage the best place to store app-images?

Internal Storage:

Files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed.

External Storage:

Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer. Data Storage in Android

Save the image to internal directory