List of usage examples for android.content Intent ACTION_PICK
String ACTION_PICK
To view the source code for android.content Intent ACTION_PICK.
Click Source Link
From source file:com.ccxt.whl.activity.SettingsFragmentC_0815.java
/** * ?/*from w w w .ja v a 2 s. c o m*/ */ public void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); //Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 600); intent.putExtra("outputY", 600); intent.putExtra("scale", true); intent.putExtra("return-data", false); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUritest); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra("noFaceDetection", true); // no face detection //startActivityForResult(intent, CHOOSE_BIG_PICTURE); startActivityForResult(intent, USERPIC_REQUEST_CODE_LOCAL); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, USERPIC_REQUEST_CODE_LOCAL_19); } /*//??? cutFile = new File(PathUtil.getInstance().getImagePath(), DemoApplication.getInstance().getUser() + System.currentTimeMillis() + "_m.jpg"); cutFile.getParentFile().mkdirs();*/ }
From source file:com.nanostuffs.yurdriver.fragment.RegisterFragment.java
private void choosePhotoFromGallary() { // Intent intent = new Intent(); // intent.setType("image/*"); // intent.setAction(Intent.ACTION_GET_CONTENT); // intent.addCategory(Intent.CATEGORY_OPENABLE); Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); registerActivity.startActivityForResult(galleryIntent, AndyConstants.CHOOSE_PHOTO, AndyConstants.REGISTER_FRAGMENT_TAG); }
From source file:app.view.chat.ChatActivity.java
/** * ?/*from w w w. java 2s .c o m*/ */ public void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } startActivityForResult(intent, REQUEST_CODE_LOCAL); }
From source file:org.gots.ui.NewSeedActivity.java
@Override public void onSelectInGallery(DialogFragment fragment) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, REQUEST_LOAD_IMAGE); }
From source file:com.android.music.MusicBrowserActivity.java
/** * get current view//from w w w.j av a2 s .com * * @param index * @return View */ private View getView(int index) { MusicLogUtils.d(TAG, "getView>>>index = " + index); View view = null; Intent intent = new Intent(Intent.ACTION_PICK); switch (index) { case ARTIST_INDEX: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/artistalbum"); break; case ALBUM_INDEX: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/album"); break; case SONG_INDEX: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); break; case PLAYLIST_INDEX: intent.setDataAndType(Uri.EMPTY, MediaStore.Audio.Playlists.CONTENT_TYPE); break; default: MusicLogUtils.d(TAG, "default"); return null; } intent.putExtra("withtabs", true); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); view = mActivityManager.startActivity(getStringId(index), intent).getDecorView(); MusicLogUtils.d(TAG, "getView<<<"); return view; }
From source file:com.uddchina.youdingdan.MyDateActivity.java
public void doPicture() { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*");// startActivityForResult(intent, 3);// www .j av a 2 s. c om }
From source file:com.mobicage.rogerthat.util.ui.SendMessageView.java
private void getNewVideo(boolean checkPermission) { if (checkPermission) { askCameraPermission(true, new SafeRunnable() { @Override/*from w w w . jav a 2 s.com*/ protected void safeRun() throws Exception { getNewVideo(false); } }); return; } if (!setupUploadFile("mp4", true)) { return; } Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); galleryIntent.putExtra(MediaStore.EXTRA_OUTPUT, mUriSavedFile); galleryIntent.setType(AttachmentViewerActivity.CONTENT_TYPE_VIDEO_MP4); final Intent chooserIntent = Intent.createChooser(galleryIntent, mActivity.getString(R.string.select_source)); if (mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) && mMainService.isPermitted(Manifest.permission.CAMERA)) { Intent cameraIntent = ActivityUtils.buildMakeVideoIntent(mActivity, mUriSavedFile); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { cameraIntent }); } mActivity.startActivityForResult(chooserIntent, PICK_VIDEO); }
From source file:com.newshiqi.yushi.ProfileActivity.java
public void initOnClick(int viewId) { View viewSet = findViewById(viewId); if (viewSet == null) { return;/*from w ww . j a v a2s. c om*/ } switch (viewId) { case R.id.p_username: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), name != null ? name : "", new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(name)) { Map<String, String> p = new HashMap<String, String>(); if ("T".equals(userType)) { p.put("nickname", value); } else if ("C".equals(userType)) { p.put("nickname", value); } else { p.put("nickname", value); } progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_usertype: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { final String[] userTypes = { getString(R.string.type_normal_user), getString(R.string.type_pro_user), getString(R.string.type_company1) }; dialog = MyDialog.showDialogList(ProfileActivity.this, getString(R.string.modify_title), userTypes, new MyDialog.ItemSelectedListener() { @Override public void onItemSelected(int position) { dialog.dismiss(); if (!userTypeValue[position].equals(userInfo.getUserType())) { userInfo.setUserType(userTypeValue[position]); Map<String, String> p = new HashMap<String, String>(); progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } // TODO // initItem(R.id.p_usertype, getText(R.string.p_usertype), // userTypes[position], true); } }); } }); break; case R.id.p_age: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { age = userInfo.getAge(); MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), age != null ? age : "", MyDialog.INPUT_TYPE_NUMBER, new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(age)) { Map<String, String> p = new HashMap<String, String>(); p.put("age", value); // TODO progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_qq: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { qq = userInfo.getQq(); MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), qq != null ? qq : "", MyDialog.INPUT_TYPE_NUMBER, new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(qq)) { Map<String, String> p = new HashMap<String, String>(); p.put("qq", value); progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_addr: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { /*if ("T".equals(userType)) { UserInfoTalent t = userInfo.getTalent(); if (t != null) { addr = t.getMapPoint(); } } else if ("C".equals(userType)) { UserInfoCom c = userInfo.getCompany(); if (c != null) { addr = c.getMapPoint(); } }*/ addr = userInfo.getAddress(); MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), addr != null ? addr : "", new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(addr)) { Map<String, String> p = new HashMap<String, String>(); if ("T".equals(userType)) { p.put("address", value); } else if ("C".equals(userType)) { p.put("address", value); } progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_intro: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { if ("T".equals(userType)) { UserInfoTalent t = userInfo.getTalent(); if (t != null) { brief = t.getDescription(); } } else if ("C".equals(userType)) { UserInfoCom c = userInfo.getCompany(); if (c != null) { brief = c.getDescription(); } } MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), brief != null ? brief : "", MyDialog.INPUT_TYPE_TEXTAREA, new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(brief)) { Map<String, String> p = new HashMap<String, String>(); if ("T".equals(userType)) { p.put("description", value); } else if ("C".equals(userType)) { p.put("description", value); } progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_license: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { uploadType = "companyLicenses"; FileUtil.deleteFile(TEMP_LICENSE_FILE_NAME); try { tempFile = FileUtil.makeDIRAndCreateFile(TEMP_LICENSE_FILE_NAME); } catch (Exception e) { } Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);//android i.putExtra("crop", "true"); // i.putExtra("aspectX", 1); i.putExtra("output", Uri.fromFile(tempFile)); i.putExtra("outputFormat", "JPEG"); i.putExtra("aspectX", 1); //? ? X ? i.putExtra("aspectY", 1); i.putExtra("outputX", 350); i.putExtra("outputY", 350); startActivityForResult(i, 3); } }); break; case R.id.p_sex: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { final String[] sexs = { getString(R.string.sex_male), getString(R.string.sex_female), getString(R.string.sex_hiden) }; dialog = MyDialog.showDialogList(ProfileActivity.this, getString(R.string.modify_title), sexs, new MyDialog.ItemSelectedListener() { @Override public void onItemSelected(int position) { dialog.dismiss(); if (!sexValue[position].equals(userInfo.getSex())) { Map<String, String> p = new HashMap<String, String>(); p.put("sex", sexValue[position]); progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } }); break; case R.id.p_phone: /*viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { MyDialog.showDialogEditText(ProfileActivity.this, getString(R.string.modify_title), mobile != null ? mobile : "", new MyDialog.EditCompleteListener() { @Override public void onComplete(String value) { if (!TextUtils.isEmpty(value) && !value.equals(mobile)) { Map<String, String> p = new HashMap<String, String>(); p.put("mobile", value); progressDialog = showProgressDialog(true, true, null); updateUserRequest(p); } } }); } });*/ break; case R.id.p_modify_pwd: viewSet.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ProfileActivity.this, ModifyPassword.class); intent.putExtra(YSH.KEY_MEMBER_ID, memberId); startActivity(intent); } }); break; default: break; } }
From source file:com.example.multi_ndef.Frag_Write.java
@Override public void onClick(View v) { // TODO Auto-generated method stub if (((Button) v).getId() == fetchto.getId()) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_MAIL); Control = "To"; }//from ww w . jav a 2 s .co m else if (((Button) v).getId() == fetchcc.getId()) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_MAIL); Control = "Cc"; } else if (((Button) v).getId() == fetchbcc.getId()) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_MAIL); Control = "Bcc"; } else if (((Button) v).getId() == addMore.getId()) { if (!numbers.getText().toString().isEmpty()) { if (noOfContacts == 1) { MultiContacts = numbers.getText().toString(); noOfContacts++; numbers.setText(""); recipients = MultiContacts; Recipients.setText(recipients); } else { MultiContacts += ";" + numbers.getText().toString(); noOfContacts++; numbers.setText(""); recipients = MultiContacts; Recipients.setText(recipients); } } } else if (((Button) v).getId() == location.getId()) { gps = new GPSTracker(Frag_Write.this); // check if GPS enabled if (gps.canGetLocation()) { latitudevalue = gps.getLatitude(); longitudevalue = gps.getLongitude(); latitude.setText(String.valueOf(latitudevalue)); longitude.setText(String.valueOf(longitudevalue)); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitudevalue + "\nLong: " + longitudevalue, Toast.LENGTH_LONG).show(); } else { // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } }
From source file:co.taqat.call.ChatFragment.java
private void pickImage() { List<Intent> cameraIntents = new ArrayList<Intent>(); Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File file = new File(Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()))); imageToUploadUri = Uri.fromFile(file); captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageToUploadUri); cameraIntents.add(captureIntent);//from ww w. jav a 2 s . c o m Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_PICK); Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.image_picker_title)); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[] {})); startActivityForResult(chooserIntent, ADD_PHOTO); }