Code example for Intent

Methods: createChoosersetType

0
        // start the image capture Intent 
        startActivityForResult(intent, SELECT_NEW_IMAGE);
    } 
 
    private void selectImageFromStorage() { 
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("image/jpeg");
 
        startActivityForResult(Intent.createChooser(intent, "Select Image"), SELECT_STORED_IMAGE);
    } 
 
    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_CANCELED) {
            // User cancelled the image capture 
            showToast(getResources().getString(R.string.info_select_logimage_cancelled)); 
            return; 
        } 
 
        if (resultCode == RESULT_OK) {
            if (data != null) {