Get pictures from your camera or album and plug them into ImageView
Jump camera A line of code things
startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), 0);
Jump albums and crop, if you do not want to crop the clip to remove the code
Intent Intent = new Intent (intent.action_get_content); Intent.putextra ("Return-data", true); Intent.settype ("image/*"); TODO tailoring Intent.putextra ("crop", "Circlecrop"); TODO crop proportions Intent.putextra ("Aspectx", 1); Intent.putextra ("Aspecty", 1); TODO Crop Size Intent.putextra ("Outputx", 240); Intent.putextra ("Outputy", 240); Startactivityforresult (Intent, 1);
We jump through Startactivityforresult and select the picture and return to Onactivityforresult.
if (Requestcode = = 0 | | requestcode = = 1) {if (data! = null) {Logutils.printlog ("Redwolf", "from phase The data returned in the machine data+ "+ data.tostring ()); Photos taken from the album or Camera Logutils.printlog ("Redwolf", "data returned from the camera data+" + Data.getextras ()); Bitmap Mbitmap = (Bitmap) Data.getextras (). Get ("data"); File localimg = new file (Environment.getexternalstoragedirectory (). Getabsolutefile (), "SRCs"); if (!localimg.exists ()) {localimg.mkdirs (); } File IconFile = new file (Localimg.getabsolutepath () + "/usericon.jpg"); if (iconfile.exists ()) {iconfile.delete (); } outputstream out = null; try {out = new FileOutputStream (iconfile); } catch (FileNotFoundException e) {e.printstacktrace (); }//2, write to local mbitmap.compress (Bitmap.CompressFormat.JPEG, +, out); 3. Plug into ImageViewZhong Mimageview.setimagebitmap (MBITMAP);
Get pictures from your camera or album and plug them into ImageView
Get a picture from a camera or album and plug it into ImageView