Saving image captured from camera to file in android -
hi in app trying take picture camera , store image in file object. writing file external storage when try retrieve file getting filenotfound exception. please me. here code used save file.
environment.getexternalstoragestate();
file mediastoragedir = new file(getcachedir(),"appname"); //mediastoragedir.mkdir(); system.out.println("directory path "+mediastoragedir.getpath()); if (! mediastoragedir.exists()){ mediastoragedir.mkdirs(); if (! mediastoragedir.mkdirs()){ log.d("mycameraapp", "failed create directory"); } } file mediafile = new file(mediastoragedir.getpath() + file.separator + "img_"+ "mypic" + ".jpg");
try add
<uses-permission android:name="android.permission.write_external_storage" />
to androidmanifest
Comments
Post a Comment