image - How to resize a photo in android? -


I'm actually new to Android but I managed to take a picture with my app and in this way I took a picture Save it and save it ... The problem is that I need to resize it before saving it on the phone ... but I do not understand how I got lost on my problem but only one thing got me Was bitmap pictures and that's not my case I think Here is the picture that I am using to take pictures:

  intent = new intent (mediastore.action_IMUNACA); File File = New File (EnvironmentalGetEnsteenStorlogical Directory (Environmental DIRECTORY_DCIM), "GUASTO" + System.currentTimeMillis () + ".jpg"); / Intent.putExtra (MediaStore.EXTRA_OUTPUT, photpath); StartActivityForResult (intent, SCATTA_FOTO);  

Thanks!

  public static id PIC_CROP = 81; Intent CropIntent = New Intent ("com.android.camera.action.CROP"); // Image type and Ure CropIntent. Point the data and type (image, "image / *"); // Set crop properties // indicate the desired crop crop signal. Input. Xtra ("aspectxx", 1); CropIntent.putExtra ("aspectY", 1); // Output X and Y Crop Indent Input Extra ("OutputX", 640); CropIntent.putExtra ("outputY", 640); // Retrieve data on Return CropInternet InputXA ("return-data" is true); // Start the activity - we handle the return to on-activity; Initial Activity ForResult (CropIntent, PIC_CROP); Override public void on  

and onActivityResult ()

  @ActriseResult (int requestcode, as a result, intent data) {if (requestcode == PIC_CROP ) {If (resultCode == RESULT_OK) {Bundle Extras = Data. GetExtras (); If (extras! = Null) {bitmap BMP = extras.dat parasable ("data"); SaveCropPhoto (BMP); } Toast. MakeApplicationContext (), "photo crop", toast. LNNGHHORT). Show (); }}}  

SaveCropFota () method

  Public Zero SecretPhotos (bitmap BMP) {Toast. MakeApplicationContext, "in save", toast .LENGTH_SHORT) .show (); String Dior = Environmental. Gestationalistorized Directory (). ToString () + "/ folderName /"; File newdir = new file (dir); Newdir.mkdirs (); FileOutputStream Out = Null; Calendar c = Calendar.getInstance (); String date = IIT (Cd. MONTH) + IITT (C.GATE (calendar DAY_OF_MONTH)) + IITT (C.Gate (calendar.IEER)) + IITT (C Gate (HORRUYY)) + From IITT (CAGAT (CalendarMINUEE) + IITT (CGAT (Calendar. SCND)); File imageFileName = new file (new, "crop_" + date.toString () + ".jpg"); {Out} Try new FileOutputStream (imageFileName); Bmp.compress (bitmap.compress format.jpeg, 100, out); Out.flush (); Out.close (); Out = null; If (tempFile.exists ()) tempFile.delete (); } Hold (exception e) {e.printStackTrace (); }}  

Comments