/** * Jump to System album * * @param activity * Active instance * @param requestcode * request code */public static void Startsystemalbumforre Sult (Activity activity,int requestcode) {Intent Intent = new Intent (Intent.action_pick,media.external_content_uri); Activity.startactivityforresult (Intent, requestcode);}
/** * Call System camera * * @param activity * Active instance * @param requestcode * request code */public static void Startsystemcameraforre Sult (Activity activity,int requestcode) {Intent Intent = new Intent (mediastore.action_image_capture); Activity.startactivityforresult (Intent, requestcode);}
/** * Start System page * * @param activity * Current Activity instance * @param requestcode * Request code * @param data * photo URI address * @param Widt H * the width of the cropped image * @param height * the high */public static void Startphotozoomforresult (Activity activity,int REQUESTC) of the picture after clipping Ode, Uri data, int width, int height) {Intent Intent = new Intent ("Com.android.camera.action.CROP"); Intent.setdataandtype (Data, "image/*");//crop is true to indicate that the view displayed can be clipped Intent.putextra ("crop", "true");//Aspectx aspecty is a ratio of width to height Intent.putextra ("Aspectx", 1); Intent.putextra ("Aspecty", 1);//Outputx,outputy is the width height of the cropped picture Intent.putextra ("Outputx", width); Intent.putextra ("outputy", height), Intent.putextra ("Return-data", true); Activity.startactivityforresult (Intent, Requestcode);}
/** * Get the picture path returned by the system album * * @param context * Context Object * @param data * Intent object carrying data * @return picture local path */public static String Getalbumimgpath (context context, Intent data) {Uri selectedimage = Data.getdata (); if (selectedimage = = null) {retur n NULL;} String[] Filepathcolumns = {MediaStore.Images.Media.DATA}; Cursor C = context.getcontentresolver (). query (selectedimage,filepathcolumns, NULL, NULL, NULL); C.movetofirst (); int ColumnIndex = C.getcolumnindex (Filepathcolumns[0]); String PicturePath = c.getstring (columnindex); C.close (); return picturepath;}
/** * Get the picture returned by the system camera Bitmap Object * * @param context * Contextual Object * @param data * Intent object carrying data * @return Picture Bitmap Object */publ IC Static Bitmap Getcameraimgbitmap (context context, Intent data) {Bundle bundle = Data.getextras (); if (Bundle! = null) {R Eturn (Bitmap) bundle.get ("Data");} return null;}
Call System Camera Album