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:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_page_virayesh); Fabric.with(this, new Crashlytics()); TextView virayeshTextinToolbar = (TextView) findViewById(R.id.virayeshTextinToolbar); final TextView zaxireTextinToolbar = (TextView) findViewById(R.id.zaxireTextinToolbar); init();//from w w w . j av a 2s .co m ableall(false); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); ImageView imageView = (ImageView) findViewById(R.id.menuButton); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { drawer.openDrawer(Gravity.END); } }); if (GlobalVar.getUserType().equals("adviser") || GlobalVar.getUserType().equals("user")) { Menu nav_Menu = navigationView.getMenu(); nav_Menu.findItem(R.id.nav_marakez).setVisible(true); nav_Menu.findItem(R.id.nav_profile).setVisible(true); nav_Menu.findItem(R.id.nav_login).setVisible(false); nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true); nav_Menu.findItem(R.id.nav_porseshha).setVisible(true); nav_Menu.findItem(R.id.nav_logout).setVisible(true); } else { Menu nav_Menu = navigationView.getMenu(); nav_Menu.findItem(R.id.nav_marakez).setVisible(true); nav_Menu.findItem(R.id.nav_profile).setVisible(false); nav_Menu.findItem(R.id.nav_login).setVisible(true); nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true); nav_Menu.findItem(R.id.nav_porseshha).setVisible(true); nav_Menu.findItem(R.id.nav_logout).setVisible(false); } final ImageView imageView1 = (ImageView) findViewById(R.id.onclickeasadinchimastanxanim); imageView1.setVisibility(View.GONE); if (isOnline()) { setAlage(); if (GlobalVar.getUserType().equals("adviser")) { virayeshTextinToolbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ableall(true); sihhhhh1.setVisibility(View.VISIBLE); sihhhhh2.setVisibility(View.VISIBLE); imageView1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent pickPhoto = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(pickPhoto, 1);//one can be replaced with any action code } }); zaxireTextinToolbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { postgetData(); } }); } }); imageView1.setVisibility(View.VISIBLE); barchasbEdit.setVisibility(View.VISIBLE); costperminEdit.setVisibility(View.VISIBLE); maxtimeEdit.setVisibility(View.VISIBLE); sexEdit.setVisibility(View.VISIBLE); dialtecEdit.setVisibility(View.VISIBLE); aboutmeEdit.setVisibility(View.VISIBLE); } else if (GlobalVar.getUserType().equals("user")) { virayeshTextinToolbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TextView textView = (TextView) findViewById(R.id.sihhhhh1); TextView textView2 = (TextView) findViewById(R.id.sihhhhh2); textView.setVisibility(View.GONE); textView2.setVisibility(View.GONE); imageView1.setVisibility(View.VISIBLE); boolean b = false; sihhhhh1.setVisibility(View.GONE); sihhhhh2.setVisibility(View.GONE); namexanivadeEdit.setEnabled(!b); shomareteleEdit.setEnabled(!b); emailEdit.setEnabled(!b); barchasbEdit.setVisibility(View.GONE); costperminEdit.setVisibility(View.GONE); maxtimeEdit.setVisibility(View.GONE); sexEdit.setVisibility(View.GONE); dialtecEdit.setVisibility(View.GONE); aboutmeEdit.setVisibility(View.GONE); imageView1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent pickPhoto = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(pickPhoto, 1);//one can be replaced with any action code } }); zaxireTextinToolbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { postgetData(); } }); } }); } } else { Toast.makeText(getApplicationContext(), "Network isn't available", Toast.LENGTH_LONG).show(); } }
From source file:org.odk.collect.android.fragments.ShowQRCodeFragment.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnScan: IntentIntegrator integrator = IntentIntegrator.forFragment(this); integrator.setCaptureActivity(ScannerWithFlashlightActivity.class).setBeepEnabled(true) .setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES).setOrientationLocked(false) .setPrompt(getString(R.string.qrcode_scanner_prompt)).initiateScan(); break;/*from www . java2 s .com*/ case R.id.btnSelect: Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, SELECT_PHOTO); break; case R.id.edit_qrcode: String[] items = new String[] { getString(R.string.admin_password), getString(R.string.server_password) }; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setTitle(R.string.include_password_dialog) .setMultiChoiceItems(items, checkedItems, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { checkedItems[which] = isChecked; } }).setCancelable(false) .setPositiveButton(R.string.generate, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { generateCode(); dialog.dismiss(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); break; } }
From source file:fr.jcf.pret.activities.PretEmpruntActivity.java
/** * Permet d'afficher la galerie pour choisir une image * /*from www . jav a 2 s . co m*/ * @param view */ public void showImageDialog(View view) { // Cration d'un intent d'affichage de la galerie Intent intentImage = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intentImage, UtilPret.PICK_IMAGE_REQUEST); }
From source file:net.reichholf.dreamdroid.fragment.ServiceListFragment.java
@SuppressWarnings("unchecked") @Override/*from ww w .ja v a 2 s. co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCurrentTitle = mBaseTitle = getString(R.string.services); mReload = true; Bundle args = getArguments(); String mode = null; if (args != null) { mode = args.getString("action"); } if (Intent.ACTION_PICK.equals(mode)) { mPickMode = true; } else { mPickMode = false; } if (savedInstanceState != null && !mPickMode) { mNavName = savedInstanceState.getString(BUNDLE_KEY_NAVNAME); mNavReference = savedInstanceState.getString(BUNDLE_KEY_NAVREFERENCE); mDetailName = savedInstanceState.getString(BUNDLE_KEY_DETAILNAME); mDetailReference = savedInstanceState.getString(BUNDLE_KEY_DETAILREFERENCE); mHistory = ExtendedHashMapHelper.restoreListFromBundle(savedInstanceState, BUNDLE_KEY_HISTORY); mNavItems = ExtendedHashMapHelper.restoreListFromBundle(savedInstanceState, BUNDLE_KEY_NAVITEMS); mDetailItems = ExtendedHashMapHelper.restoreListFromBundle(savedInstanceState, BUNDLE_KEY_DETAILITEMS); mCurrentService = ExtendedHashMapHelper.restoreFromBundle(savedInstanceState, BUNDLE_KEY_CURRENT_SERVICE); mReload = false; } else { mHistory = new ArrayList<ExtendedHashMap>(); if (!SERVICE_REF_ROOT.equals(mNavReference)) { ExtendedHashMap map = new ExtendedHashMap(); map.put(Event.KEY_SERVICE_REFERENCE, mNavReference); map.put(Event.KEY_SERVICE_NAME, mNavName); mHistory.add(map); mExtras = getArguments(); mNavItems = new ArrayList<ExtendedHashMap>(); mDetailItems = new ArrayList<ExtendedHashMap>(); } } if (mDetailReference == null) { mDetailReference = DreamDroid.getCurrentProfile().getDefaultRef(); mDetailName = DreamDroid.getCurrentProfile().getDefaultRefName(); } // if( mNavReference == null ){ // mNavReference = DreamDroid.getCurrentProfile().getDefaultRef2(); // mNavName = DreamDroid.getCurrentProfile().getDefaultRef2Name(); // } if (mExtras != null) { HashMap<String, Object> map = (HashMap<String, Object>) mExtras.getSerializable("data"); if (map != null) { mData = new ExtendedHashMap(); mData.putAll(map); } } else { mExtras = new Bundle(); } }
From source file:ca.psiphon.ploggy.FragmentComposeMessage.java
private void selectPicture() { Intent intent;// www .ja v a 2s . c om if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); } else { // TODO: properly support the new Storage Access Framework invoked for // Intent.ACTION_GET_CONTENT on KitKat: // https://developer.android.com/guide/topics/providers/document-provider.html // This includes getting results from cloud providers such as // Drive -- which are only available as streams, not files. // For now, forcing the equivilent of pre-KitKat gallery selection... intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } intent.setType("image/*"); // Note: assumes nested fragment getParentFragment().startActivityForResult( Intent.createChooser(intent, getText(R.string.prompt_compose_message_select_picture)), REQUEST_CODE_SELECT_IMAGE); }
From source file:com.trail.octo.UploadDocs.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upload_docs); sharedPreferences = getSharedPreferences("user_data", MODE_PRIVATE); user_name = sharedPreferences.getString("user_name", ""); sharedPreferences_docs = getSharedPreferences("docs_data", MODE_PRIVATE); upload_docs_pan_select = (ImageView) findViewById(R.id.upload_docs_pan_select); upload_docs_driving_select = (ImageView) findViewById(R.id.upload_docs_driving_select); upload_docs_aadhar_select = (ImageView) findViewById(R.id.upload_docs_aadhar_select); upload_docs_voter_select = (ImageView) findViewById(R.id.upload_docs_voter_select); upload_docs_passport_select = (ImageView) findViewById(R.id.upload_docs_passport_select); if (sharedPreferences_docs.getString("pancard", "").equals("")) pan = true;/*from w ww . j ava2s .c om*/ else upload_docs_pan_select.setVisibility(View.VISIBLE); if (sharedPreferences_docs.getString("drivinglicense", "").equals("")) driving = true; else upload_docs_driving_select.setVisibility(View.VISIBLE); if (sharedPreferences_docs.getString("voterid", "").equals("")) voter = true; else upload_docs_voter_select.setVisibility(View.VISIBLE); if (sharedPreferences_docs.getString("aadharcard", "").equals("")) aadhar = true; else upload_docs_aadhar_select.setVisibility(View.VISIBLE); if (sharedPreferences_docs.getString("passport", "").equals("")) passport = true; else upload_docs_passport_select.setVisibility(View.VISIBLE); if (savedInstanceState != null) file_type = savedInstanceState.getString("file_type"); imageView_camera = (ImageView) findViewById(R.id.upload_docs_camera); imageView_gallery = (ImageView) findViewById(R.id.upload_docs_gallery); imageView_profilepic = (ImageView) findViewById(R.id.upload_docs_profile_pic); linearLayout_aadhar = (LinearLayout) findViewById(R.id.upload_docs_aadhar); linearLayout_driving = (LinearLayout) findViewById(R.id.upload_docs_driving); linearLayout_pan = (LinearLayout) findViewById(R.id.upload_docs_pan); linearLayout_voter = (LinearLayout) findViewById(R.id.upload_docs_voter); linearLayout_passport = (LinearLayout) findViewById(R.id.upload_docs_passport); button_submit = (Button) findViewById(R.id.upload_docs_submit); button_submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (user_name.equals("")) { Intent intent = new Intent(getApplicationContext(), LoginActivity.class); startActivity(intent); } else { Intent intent = new Intent(getApplicationContext(), Home.class); startActivity(intent); } } }); imageView_camera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (askCameraPermission()) { file_type = "profilepic"; Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, REQUEST_CAMERA); } } }); imageView_gallery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (askGalleryPermission()) { file_type = "profilepic"; Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); } } }); LayoutInflater layoutInflater = (LayoutInflater) getBaseContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = layoutInflater.inflate(R.layout.loading_popup_window, null); popupWindow = new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true); view_select = layoutInflater.inflate(R.layout.popup_image_capture, null); popup_imageView_camera = (ImageView) view_select.findViewById(R.id.popup_imageView_camera); popup_imageView_gallery = (ImageView) view_select.findViewById(R.id.popup_imageView_gallary); popupWindow_select_source = new PopupWindow(view_select, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); popupWindow_select_source.setFocusable(false); popupWindow_select_source.setBackgroundDrawable(new BitmapDrawable()); popupWindow_select_source.setOutsideTouchable(true); popup_imageView_gallery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (askGalleryPermission()) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); } } }); popup_imageView_camera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (askCameraPermission()) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, REQUEST_CAMERA); } } }); linearLayout_driving.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (driving) { file_type = "drivinglicense"; popupWindow_select_source.showAtLocation(view_select, Gravity.CENTER, 0, 40); } else Toast.makeText(getApplicationContext(), "You have already uploaded the Driving license", Toast.LENGTH_SHORT).show(); } }); linearLayout_pan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (pan) { file_type = "pancard"; popupWindow_select_source.showAtLocation(view_select, Gravity.CENTER, 0, 40); } else Toast.makeText(getApplicationContext(), "You have already uploaded the Pan Card", Toast.LENGTH_SHORT).show(); } }); linearLayout_aadhar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (aadhar) { file_type = "aadharcard"; popupWindow_select_source.showAtLocation(view_select, Gravity.CENTER, 0, 40); } else Toast.makeText(getApplicationContext(), "You have already uploaded the Aadhar Card", Toast.LENGTH_SHORT).show(); } }); linearLayout_voter.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (voter) { file_type = "voterid"; popupWindow_select_source.showAtLocation(view_select, Gravity.CENTER, 0, 40); } else Toast.makeText(getApplicationContext(), "You have already uploaded the Voter id", Toast.LENGTH_SHORT).show(); } }); linearLayout_passport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (passport) { file_type = "passport"; popupWindow_select_source.showAtLocation(view_select, Gravity.CENTER, 0, 40); } else Toast.makeText(getApplicationContext(), "You have already uploaded the Passport", Toast.LENGTH_SHORT).show(); } }); }
From source file:com.vignesh.conf.SettingsFragment.java
@Override public boolean onPreferenceClick(Preference preference) { Log.e("ERR", "DASDASDSAD " + preference.getKey()); switch (preference.getKey()) { case "contact": startActivityForResult(/* w w w . ja v a 2 s . c o m*/ new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI), 800); return true; case "calendar": changeCalendar(); return true; default: return false; } }
From source file:com.itime.team.itime.fragments.ProfileFragment.java
@Override public void onClick(View v) { int id = v.getId(); Bundle bundle = new Bundle(); switch (id) { case R.id.setting_profile_picture: { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, REQUEST_IMAGE_SELECT); break;//from ww w. ja v a 2 s .c o m } case R.id.setting_profile_name: { final Intent intent = new Intent(getActivity(), InputDialogActivity.class); intent.putExtra(InputDialogActivity.INPUT_DIALOG_TITLE, "Edit User Name"); startActivityForResult(intent, REQUEST_SET_USER_NAME); break; } case R.id.setting_profile_qrcode: final QRCodeFragment qrCodeFragment = new QRCodeFragment(); final Bundle args = new Bundle(); args.putString(QRCodeFragment.QRCODE_STRING, mUserId); qrCodeFragment.setArguments(args); qrCodeFragment.show(getActivity().getSupportFragmentManager(), "qrcode_fragment"); //FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); //ft.add(qrCodeFragment, "qrcode_fragment"); //ft.commit(); break; case R.id.setting_profile_email: { final Intent intent = new Intent(getActivity(), InputDialogActivity.class); intent.putExtra(InputDialogActivity.INPUT_DIALOG_TITLE, "Edit Your Email"); startActivityForResult(intent, REQUEST_SET_EMAIL); break; } case R.id.setting_profile_phone_number: { final Intent intent = new Intent(getActivity(), InputDialogActivity.class); intent.putExtra(InputDialogActivity.INPUT_DIALOG_TITLE, "Edit Your Phone Number"); startActivityForResult(intent, REQUEST_SET_PHONE_NUMBER); break; } } }
From source file:org.blanco.techmun.android.MensajesActivity.java
private void attachImage() { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, 0); }
From source file:com.money.manager.ex.search.SearchFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) return null; View view = inflater.inflate(R.layout.search_fragment, container, false); initializeUiControlVariables(view);/*from www. ja va 2 s . co m*/ initializeAmountSelectors(view); // Account if (mAccountList == null) { LookAndFeelSettings settings = new AppSettings(getContext()).getLookAndFeelSettings(); AccountService accountService = new AccountService(getContext()); mAccountList = accountService.getAccountList(settings.getViewOpenAccounts(), settings.getViewFavouriteAccounts()); mAccountList.add(0, null); for (int i = 0; i <= mAccountList.size() - 1; i++) { if (mAccountList.get(i) != null) { mAccountNameList.add(mAccountList.get(i).getName()); mAccountIdList.add(mAccountList.get(i).getId()); } else { mAccountNameList.add(""); mAccountIdList.add(AdapterView.INVALID_POSITION); } } } // create adapter for spinAccount ArrayAdapter<String> adapterAccount = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mAccountNameList); adapterAccount.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinAccount.setAdapter(adapterAccount); //Payee txtSelectPayee.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), PayeeActivity.class); intent.setAction(Intent.ACTION_PICK); startActivityForResult(intent, REQUEST_PICK_PAYEE); } }); //Category txtSelectCategory.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), CategoryListActivity.class); intent.setAction(Intent.ACTION_PICK); startActivityForResult(intent, REQUEST_PICK_CATEGORY); } }); // Status if (mStatusItems.size() <= 0) { // add blank row mStatusItems.add(""); mStatusValues.add(SearchParameters.STRING_NULL_VALUE); mStatusItems.addAll(Arrays.asList(getResources().getStringArray(R.array.status_items))); mStatusValues.addAll(Arrays.asList(getResources().getStringArray(R.array.status_values))); } // create adapter for spinnerStatus ArrayAdapter<String> adapterStatus = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mStatusItems); adapterStatus.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinStatus.setAdapter(adapterStatus); // Date from txtDateFrom.setOnClickListener(new OnDateButtonClickListener(getActivity(), txtDateFrom)); // Date to txtDateTo.setOnClickListener(new OnDateButtonClickListener(getActivity(), txtDateTo)); initializeResetButton(view); // Store search criteria values into the controls. displaySearchCriteria(view); return view; }