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.example.multi_ndef.Frag_Write.java

public void initialize() {
    fatchContact = (Button) findViewById(R.id.button2);

    // button that starts the tag-write procedure

    mUri = (EditText) findViewById(R.id.editText3);
    mTxt = (EditText) findViewById(R.id.editText2);
    // TextView that we'll use to output messages to screen
    mTextView1 = (TextView) findViewById(R.id.textView1);
    mTextView2 = (TextView) findViewById(R.id.textView2);

    mEditText1 = (EditText) findViewById(R.id.editText1);

    v_name = (EditText) findViewById(R.id.editText4);
    v_number = (EditText) findViewById(R.id.editText5);
    v_mail = (EditText) findViewById(R.id.editText6);
    v_add = (EditText) findViewById(R.id.editText7);

    mSpinner = (Spinner) findViewById(R.id.spinner);

    btSpinner = (Spinner) findViewById(R.id.spinnerbt);

    addMore = (Button) findViewById(R.id.addRec);

    numbers = (EditText) findViewById(R.id.editcontact);
    Recipients = (TextView) findViewById(R.id.Recipients);

    message = (EditText) findViewById(R.id.editmessage);

    body = (EditText) findViewById(R.id.editBody);
    to = (EditText) findViewById(R.id.editTo);
    cc = (EditText) findViewById(R.id.editCc);
    bcc = (EditText) findViewById(R.id.editBcc);
    subject = (EditText) findViewById(R.id.editSubject);

    fetchto = (Button) findViewById(R.id.addto);
    fetchto.setOnClickListener(this);

    fetchcc = (Button) findViewById(R.id.addcc);
    fetchcc.setOnClickListener(this);

    fetchbcc = (Button) findViewById(R.id.addbcc);
    fetchbcc.setOnClickListener(this);

    telephone = (EditText) findViewById(R.id.editTelephone);

    location = (Button) findViewById(R.id.location);
    location.setOnClickListener(this);
    latitude = (EditText) findViewById(R.id.editlatitude);
    longitude = (EditText) findViewById(R.id.editlongitude);
    addMore.setOnClickListener(this);
    fatchContact.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
            startActivityForResult(intent, PICK_CONTACT);

        }//from   w w  w.  ja  v  a  2s .  c  o m
    });

    fetchContact = (Button) findViewById(R.id.fetchContact);

}

From source file:es.uma.lcc.lockpic.MainActivity.java

public void buttonDecryptClick(View view) {
    // intent for launching the gallery
    Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(i, ACTIVITY_PICK_IMAGE_DEC);
}

From source file:nl.atcomputing.spacetravelagency.fragments.CheckoutFragment.java

public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;// w  w w.  j  a  va  2 s  .  co  m
    switch (item.getItemId()) {
    case R.id.menu_invite_a_friend:
        intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
        startActivityForResult(intent, 1);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:it.angelic.soulissclient.TagDetailActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    ImageView icon = (ImageView) findViewById(R.id.node_icon);
    switch (item.getItemId()) {
    case android.R.id.home:

        Fragment details = getSupportFragmentManager().findFragmentById(R.id.detailPane);
        Log.w(Constants.TAG, "instanceof: " + details.getClass());
        if (details instanceof TagDetailFragment)
            supportFinishAfterTransition();
        else {/*from  w ww.  ja  va  2 s  .c  o m*/
            getSupportFragmentManager().popBackStack();
            setActionBarInfo(collected.getNiceName());
        }
        return true;
    case R.id.Opzioni:
        Intent settingsActivity = new Intent(this, PreferencesActivity.class);
        startActivity(settingsActivity);
        final Intent preferencesActivity = new Intent(this.getBaseContext(), PreferencesActivity.class);
        // evita doppie aperture per via delle sotto-schermate
        preferencesActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(preferencesActivity);
        return true;
    case R.id.scegliconaTag:
        AlertDialog.Builder alert2 = AlertDialogHelper.chooseIconDialog(this, icon, null, db, collected);
        alert2.show();
        return true;
    case R.id.rinominaTag:
        AlertDialog.Builder alert = AlertDialogHelper.renameSoulissObjectDialog(this, actionTitleTextView, null,
                db, collected);
        alert.show();
        return true;
    case R.id.scegliImmagineTag:
        Intent intent = new Intent(Intent.ACTION_PICK,
                android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        startActivityForResult(intent, collected.getTagId().intValue());
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.example.android.notepad.NotesList.java

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    Uri uri = ContentUris.withAppendedId(getIntent().getData(), id);

    String action = getIntent().getAction();
    if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) {
        // The caller is waiting for us to return a note selected by
        // the user.  The have clicked on one, so return it now.
        setResult(RESULT_OK, new Intent().setData(uri));
    } else {/*from www.ja  v  a  2 s .  c o  m*/
        // Launch activity to view/edit the currently selected item
        startActivity(new Intent(Intent.ACTION_EDIT, uri));
    }
}

From source file:com.money.manager.ex.account.AccountListFragment.java

@Override
protected void setResult() {
    Intent result;//w w w.  ja v a  2  s.  co m
    if (Intent.ACTION_PICK.equals(mAction)) {
        // take cursor
        Cursor cursor = ((SimpleCursorAdapter) getListAdapter()).getCursor();

        for (int i = 0; i < getListView().getCount(); i++) {
            if (getListView().isItemChecked(i)) {
                cursor.moveToPosition(i);
                result = new Intent();
                result.putExtra(AccountListActivity.INTENT_RESULT_ACCOUNTID,
                        cursor.getInt(cursor.getColumnIndex(Account.ACCOUNTID)));
                result.putExtra(AccountListActivity.INTENT_RESULT_ACCOUNTNAME,
                        cursor.getString(cursor.getColumnIndex(Account.ACCOUNTNAME)));
                getActivity().setResult(Activity.RESULT_OK, result);
                return;
            }
        }
    }
    // return cancel
    getActivity().setResult(AccountListActivity.RESULT_CANCELED);
}

From source file:com.activiti.android.ui.fragments.form.picker.ActivitiUserPickerFragment.java

private void pickContact() {
    Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
    intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_TYPE);

    try {// w ww. j a  v  a  2  s  .co  m
        startActivityForResult(intent, RequestCode.PICK_CONTACT);
    } catch (ActivityNotFoundException a) {
        // Error
    }
}

From source file:org.zywx.wbpalmstar.plugin.uexcontacts.EUExContact.java

public void open(String[] parm) {
    Intent intent = new Intent();

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
        intent.setAction(Intent.ACTION_PICK);
        intent.setData(android.provider.Contacts.People.CONTENT_URI);
    } else {//w  ww .  j a va 2 s. c  om
        intent.setAction(Intent.ACTION_PICK);
        intent.setData(android.provider.ContactsContract.Contacts.CONTENT_URI);
    }
    startActivityForResult(intent, F_ACT_REQ_CODE_UEX_CONTACT);
}

From source file:org.arshad.nimbleme.WritingActivity.java

@Override
public void onClick(View view) {
    if (R.id.id_shortcut_insert_photo == view.getId()) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_PICK);// Pick an item from the images
        intent.setType("image/*");
        startActivityForResult(intent, SYSTEM_GALLERY);
        return;// w  w w . j a va  2 s . c o m
    } else if (R.id.id_shortcut_insert_link == view.getId()) {
        MarkdownUtils.newInstance().insertLink(WritingActivity.this, getPerformEditable());
        return;
    } else if (R.id.id_shortcut_grid == view.getId()) {
        MarkdownUtils.newInstance().insertTable(WritingActivity.this, getPerformEditable());
        return;
    } else {
        getPerformEditable().onClick(view);
        return;
    }
}

From source file:bander.notepad.NoteListAppCompat.java

public void onItemClick(AdapterView<?> l, View v, int position, long id) {
    Uri uri = ContentUris.withAppendedId(getIntent().getData(), id);

    String action = getIntent().getAction();
    if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) {
        setResult(RESULT_OK, new Intent().setData(uri).setClassName(getApplicationContext().getPackageName(),
                "bander.notepad.NoteEditAppCompat"));
    } else {/*from w ww. ja v  a2  s  .  co m*/
        startActivity(new Intent(Intent.ACTION_EDIT, uri).setClassName(getApplicationContext().getPackageName(),
                "bander.notepad.NoteEditAppCompat"));
    }
}