List of usage examples for android.content Intent getData
public @Nullable Uri getData()
From source file:cn.net_show.doctor.activity.AuthActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 1111://from w w w .j av a2s . com if (resultCode == 0) { // uri = null; //Toast.makeText(this, "?", Toast.LENGTH_SHORT).show(); return; } Log.e("resultCode", "resultCode=" + resultCode); uri = data.getData(); //authImage.setImageURI(uri); ImageLoader.getInstance().displayImage(uri.toString(), authImage); break; default: break; } }
From source file:ca.rmen.android.scrumchatter.main.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == ACTIVITY_REQUEST_CODE_IMPORT && resultCode == Activity.RESULT_OK) { if (intent.getData() == null) { Toast.makeText(this, R.string.import_result_no_file, Toast.LENGTH_SHORT).show(); return; }//from ww w . j a va 2s. com final String filePath = intent.getData().getPath(); if (TextUtils.isEmpty(filePath)) { Toast.makeText(this, R.string.import_result_no_file, Toast.LENGTH_SHORT).show(); return; } final File file = new File(filePath); if (!file.exists()) { Toast.makeText(this, getString(R.string.import_result_file_does_not_exist, file.getName()), Toast.LENGTH_SHORT).show(); return; } importDB(Uri.fromFile(file)); } else { super.onActivityResult(requestCode, resultCode, intent); } }
From source file:com.example.parking.ParkingInformationActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { switch (requestCode) { case TAKE_PHOTO: //? if (data.getData() != null || data.getExtras() != null) { // Uri uri = data.getData(); if (uri != null) { if (mEnterImage == null) { mEnterImage = BitmapFactory.decodeFile(uri.getPath()); // }//from w w w . j a va2 s .c om } Bundle bundle = data.getExtras(); if (bundle != null) { if (mEnterImage == null) { mEnterImage = (Bitmap) bundle.get("data"); } } } if (mEnterImage != null) { mEnterImageIV.setImageBitmap(mEnterImage); } break; } } }
From source file:net.internetTelephone.program.project.init.create.ProjectCreateFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RESULT_REQUEST_PHOTO) { if (resultCode == Activity.RESULT_OK) { if (data != null) { fileUri = data.getData(); }/*from w w w . j av a2s .c o m*/ fileCropUri = CameraPhotoUtil.getOutputMediaFileUri(); Global.cropImageUri(this, fileUri, fileCropUri, 600, 600, RESULT_REQUEST_PHOTO_CROP); } } else if (requestCode == RESULT_REQUEST_PHOTO_CROP) { if (resultCode == Activity.RESULT_OK) { try { String filePath = FileUtil.getPath(getActivity(), fileCropUri); projectIcon.setImageURI(fileCropUri); projectInfo.icon = filePath; } catch (Exception e) { Global.errorLog(e); } } } else if (requestCode == RESULT_REQUEST_PICK_TYPE) { if (resultCode == Activity.RESULT_OK) { String type = data.getStringExtra("type"); if (TextUtils.isEmpty(type)) { return; } currentType = type; projectTypeText.setText(currentType); } } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:net.coding.program.project.init.create.ProjectCreateFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RESULT_REQUEST_PHOTO) { if (resultCode == Activity.RESULT_OK) { if (data != null) { fileUri = data.getData(); }/* w w w . j a v a2s.co m*/ fileCropUri = CameraPhotoUtil.getOutputMediaFileUri(); Global.cropImageUri(this, fileUri, fileCropUri, 600, 600, RESULT_REQUEST_PHOTO_CROP); } } else if (requestCode == RESULT_REQUEST_PHOTO_CROP) { if (resultCode == Activity.RESULT_OK) { try { String filePath = Global.getPath(getActivity(), fileCropUri); projectIcon.setImageURI(fileCropUri); projectInfo.icon = filePath; } catch (Exception e) { Global.errorLog(e); } } } else if (requestCode == RESULT_REQUEST_PICK_TYPE) { if (resultCode == Activity.RESULT_OK) { String type = data.getStringExtra("type"); if (TextUtils.isEmpty(type)) { return; } currentType = type; projectTypeText.setText(currentType); } } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:blackman.matt.infinitebrowser.InfinityBrowser.java
/** * Load a board using a variety of logics. *///from w w w. j ava 2 s . c o m private void loadUpABoard() { // Load preferences for activity SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); Boolean ageAccept = preferences.getBoolean("age_guard_accept", false); // Checks if age guard has been accepted if (!ageAccept) { DialogFragment ageGuardDialog = new AgeGuardDialogFragment(); ageGuardDialog.show(getFragmentManager(), "ageGuardDialog"); } else { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Board newBoard; Intent intent = getIntent(); String defaultBoard = preferences.getString("default_board", "").toLowerCase(); if (intent.getData() != null || intent.getExtras() != null) { newBoard = loadFromIntent(intent); } else if (!defaultBoard.equals("")) { newBoard = Board.newInstance(defaultBoard); mTitle = "/" + defaultBoard.toLowerCase() + "/"; } else { newBoard = getFirstDrawerItem(); } if (newBoard != null) { fragmentTransaction.replace(R.id.container, newBoard, mTitle.toString()); findViewById(R.id.ll_help_add_boards).setVisibility(View.GONE); setTitle(mTitle); } fragmentTransaction.commit(); } }
From source file:com.apptentive.android.sdk.ViewActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case Constants.REQUEST_CODE_PHOTO_FROM_MESSAGE_CENTER: MessageCenterView.showAttachmentDialog(this, data.getData()); break; default://from w w w . j a va 2 s .c om break; } } }
From source file:com.activiti.android.ui.fragments.form.picker.ActivitiUserPickerFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RequestCode.PICK_CONTACT: { if (resultCode == Activity.RESULT_OK && data != null) { try { Uri contactUri = data.getData(); // Cursor loader to query optional contact email CursorLoader clEmail = new CursorLoader(getActivity()); clEmail.setProjection(new String[] { ContactsContract.CommonDataKinds.Email.ADDRESS }); clEmail.setUri(contactUri); Cursor cursor = clEmail.loadInBackground(); cursor.moveToFirst();/* w w w . j ava2 s . co m*/ // Retrieve the phone number from the NUMBER column int column = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS); String email = cursor.getString(column); searchForm.setText(email); ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(true); } catch (Exception error) { Snackbar.make(getActivity().findViewById(R.id.left_panel), error.getMessage(), Snackbar.LENGTH_LONG).show(); } } break; } default: super.onActivityResult(requestCode, resultCode, data); break; } }
From source file:co.vanir.indecentxposure.IndecentXposure.java
@Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { start(context);//from ww w . j av a 2 s.c o m } else if (intent.getAction().equals(intent.ACTION_PACKAGE_ADDED) || intent.getAction().equals(intent.ACTION_PACKAGE_REMOVED)) { //handle package install/uninstall all smart-like if (intent.getData() == null || intent.getData().getScheme() == null || !intent.getData().getScheme().equals("package") || intent.getData().getEncodedSchemeSpecificPart() == null) { Log.e(TAG, "Received garbage package data in intent"); return; } //are you my mommy? if (!intent.getData().getEncodedSchemeSpecificPart().equals(SerialOffender.getPackageName())) { Log.v(TAG, "Ignoring irrelevant package addition/removal"); return; } if (intent.getAction().equals(intent.ACTION_PACKAGE_ADDED)) { //sound the alarm IndecentXposure.notify(context, "package installed -- and something about the consequences of that"); } else { //all is well that ends well IndecentXposure.cancel(context); if (SerialOffender.getIgnoredState(context)) { //reload, in case xposed gets reinstalled SerialOffender.setIgnoredState(context, false); } } } else { //if it's not boot, and not pack add/remove, then the user must've chosen the "ignore risks" option on the notification Log.i(TAG, "Received ignore request"); SerialOffender.setIgnoredState(context, true); IndecentXposure.cancel(context); } }
From source file:com.intel.xdk.camera.Camera.java
public void imageSelected(Intent intent) { String filePath = Camera.getPath(activity, intent.getData()); System.out.println("AppMobiCamera.imageSelected: " + filePath); if (filePath != null) { File f = new File(filePath); savePicture(f.getAbsolutePath(), 100, false); }/* w w w. j a v a 2s . c o m*/ busy = false; }