android - How to save the image automatically when using camera intent from my app? -


when using camera intent app opening camera after clicking asks save image when click image using mobile camera app saves automatically.

using camera intent opens same inbuild camera app why thid dual behaviour?

also how make camera save image automatically when using camera intent app

try this

 @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);      //get image camera     if (requestcode == camera_click_result && resultcode == result_ok) {          dialog2.dismiss();         bitmap photo = null;         try {             photo = mediastore.images.media.getbitmap(                     getcontentresolver(), imageuri);         } catch (ioexception e) {             e.printstacktrace();         }         selectedimage = getresizedbitmap(photo, 900)           try {             //write file             filename = "your file name.extension";             file file = new file("directory path want save");             file.mkdir();             fileoutputstream fileoutputstream = new fileoutputstream(file + filename);             selectedimage.compress(bitmap.compressformat.png, 100, fileoutputstream);              //cleanup             fileoutputstream.close();          } catch (exception e) {             e.printstacktrace();         }   } }  //resize bitmap public bitmap getresizedbitmap(bitmap image, int maxsize) {     int width = image.getwidth();     int height = image.getheight();      float bitmapratio = (float) width / (float) height;     if (bitmapratio > 1) {         width = maxsize;         height = (int) (width / bitmapratio);     } else {         height = maxsize;         width = (int) (height * bitmapratio);     }     return bitmap.createscaledbitmap(image, width, height, true); } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -