Example usage for android.content Intent ACTION_PICK

List of usage examples for android.content Intent ACTION_PICK

Introduction

In this page you can find the example usage for android.content Intent ACTION_PICK.

Prototype

String ACTION_PICK

To view the source code for android.content Intent ACTION_PICK.

Click Source Link

Document

Activity Action: Pick an item from the data, returning what was selected.

Usage

From source file:com.xortech.multipanic.PanicAddUpdate.java

/**
 * METHOD TO ALLOW A USER TO IMPORT THE NAME AND NUMBER FROM THE CONTACT LIST
 *//*from   w w w  .  j  ava 2s .co m*/
public void OnClickSelectContact() {
    // PICK A CONTACT FROM THE CONTACT LIST
    startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI),
            REQUEST_CODE_PICK_CONTACTS);
}

From source file:com.ranglerz.tlc.tlc.com.ranglerz.tlc.tlc.Insurance.ReportAccident.java

private void galleryIntent() {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_PICK);//
    startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
}

From source file:com.nanostuffs.yurdriver.fragment.VehicalRegistration.java

private void choosePhotoFromGallary(int code) {

    // Intent intent = new Intent();
    // intent.setType("image/*");
    // intent.setAction(Intent.ACTION_GET_CONTENT);
    // intent.addCategory(Intent.CATEGORY_OPENABLE);

    vehflag = 2;/*from   w  ww. j a  v a  2 s.  co  m*/
    Intent galleryIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    registerActivity.startActivityForResult(galleryIntent, code, AndyConstants.REGISTER_FRAGMENT_TAG);

}

From source file:com.app.sample.chatting.activity.chat.ChatActivity.java

/**
 * ?/*from  w w  w .  j a v  a  2s. c  o  m*/
 */
private void goToAlbum() {
    Intent intent;
    if (Build.VERSION.SDK_INT < 19) {
        intent = new Intent();
        intent.setAction(Intent.ACTION_GET_CONTENT);
        intent.setType("image/*");
        startActivityForResult(Intent.createChooser(intent, ""), REQUEST_CODE_GETIMAGE_BYSDCARD);
    } else {
        intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        intent.setType("image/*");
        startActivityForResult(Intent.createChooser(intent, ""), REQUEST_CODE_GETIMAGE_BYSDCARD);
    }

}

From source file:cn.com.caronwer.activity.CertificationActivity.java

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
    case 100: {/*w  w w . j av a 2s .  co m*/
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Intent takeIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            //????
            takeIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri
                    .fromFile(new File(Environment.getExternalStorageDirectory(), IMAGE_FILE_NAME[imgType])));
            startActivityForResult(takeIntent, REQUESTCODE_TAKE);
        } else {
            Toast.makeText(CertificationActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show();
        }
        return;
    }
    case 200: {

        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Intent pickIntent = new Intent(Intent.ACTION_PICK, null);
            pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
            startActivityForResult(pickIntent, REQUESTCODE_PICK);
        } else {
            Toast.makeText(CertificationActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show();
        }
        return;
    }
    case 300: {

        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            //getServletData();
        } else {
            Toast.makeText(CertificationActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show();
        }
        return;
    }
    }
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

From source file:com.lepin.activity.CarDriverVerify.java

private void getImageByGallery() {
    Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    intent.setType("image/jpeg");
    startActivityForResult(intent, IMAGE_RESULT);
}

From source file:com.hivewallet.androidclient.wallet.ui.WalletActivity.java

private void handleImportKeys() {
    try {//w  w  w .j a  v  a2s  . com
        final Intent intent = new Intent(Intent.ACTION_PICK);
        startActivityForResult(intent, REQUEST_PICK_BACKUP);
    } catch (ActivityNotFoundException e) {
        longToast(R.string.import_keys_dialog_no_external_source);
    }
}

From source file:com.esri.arcgisruntime.sample.editfeatureattachments.EditAttachmentActivity.java

private void selectAttachment() {

    Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

    startActivityForResult(i, RESULT_LOAD_IMAGE);

}

From source file:passenger.view.activity.UploadUserDataActivity.java

/**
     * ?/*from  ww  w .  j  a  va2 s  .co m*/
     */
    public Intent getCropImageIntent() {
        Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        setIntentParams(intent);
        return intent;
    }

From source file:com.raspi.chatapp.ui.chatting.ChatActivity.java

public void sendLibraryImage(View view) {
    // hide the popup
    View v = findViewById(R.id.popup_layout);
    if (v != null) {
        v.setVisibility(View.GONE);
        attachPopup = false;//w w  w  .j  a va  2s.c o  m
    }
    // when clicking attack the user should at first select an application to
    // choose the image with and then choose an image.
    // this intent is for getting the image
    Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
    getIntent.setType("image/*");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
        getIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);

    // and this for getting the application to get the image with
    Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    pickIntent.setType("image/*");

    // and this finally is for opening the chooserIntent for opening the
    // getIntent for returning the image uri. Yep, thanks android
    Intent chooserIntent = Intent.createChooser(getIntent, getResources().getString(R.string.select_image));
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { pickIntent });
    startActivityForResult(chooserIntent, SEND_LIBRARY_IMAGE_REQUEST_CODE);
    // nope I don't want to be asked for a pwd when selected the image
    getSharedPreferences(Constants.PREFERENCES, 0).edit().putBoolean(Constants.PWD_REQUEST, false).apply();
}