List of usage examples for android.content Intent getData
public @Nullable Uri getData()
From source file:com.activiti.android.ui.fragments.task.form.TaskFormFoundationFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (requestCode == ContentTransferManager.PICKER_REQUEST_CODE && resultCode == Activity.RESULT_OK) { MultiValueField field = (MultiValueField) formManager.getCurrentPickerField(); RelatedContentRepresentation content = ContentTransferManager.getRelatedContent(getActivity(), resultData.getData()); field.addValue(content);/*from ww w . j a v a2s . co m*/ formManager.setCurrentPickerField(null); } }
From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); if (resultCode == RESULT_OK) { final Uri imageUri = imageReturnedIntent.getData(); InputStream imageStream = null; try {//w w w . j a va2 s .c o m imageStream = getContentResolver().openInputStream(imageUri); } catch (FileNotFoundException e) { e.printStackTrace(); } final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream); imageviewuserVirayesh.setImageURI(imageUri); selectedImageString = encodeImage(selectedImage); Log.i("asadsddfghghjhj", selectedImageString); } }
From source file:de.ub0r.android.callmeter.ui.prefs.Preferences.java
/** * {@inheritDoc}/* w w w . jav a2s .co m*/ */ @Override protected final void onNewIntent(final Intent intent) { final Uri uri = intent.getData(); Log.d(TAG, "new intent: " + intent.getAction()); Log.d(TAG, "intent: " + intent.getData()); if (uri != null) { Log.d(TAG, "importing: " + uri.toString()); this.importData(this, uri); } }
From source file:ca.rmen.android.poetassistant.main.reader.ReaderFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d(TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]"); if (requestCode == ACTION_FILE_OPEN && resultCode == Activity.RESULT_OK) { if (data != null) { Uri uri = data.getData(); PoemFile.open(getActivity(), uri, this); }/*from ww w . j a v a 2 s . c o m*/ } else if (requestCode == ACTION_FILE_SAVE_AS && resultCode == Activity.RESULT_OK) { if (data != null) { Uri uri = data.getData(); PoemFile.save(getActivity(), uri, mBinding.tvText.getText().toString(), this); } } }
From source file:app.axe.imooc.zxing.app.CaptureActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { uri = data.getData(); new Thread(new Runnable() { @Override/*from www .jav a 2 s . c om*/ public void run() { Result result = scanningImage(uri); if (result == null) { Looper.prepare(); Toast.makeText(getApplicationContext(), "?", Toast.LENGTH_SHORT).show(); Looper.loop(); } else { // ??? String recode = (result.toString()); Intent data = new Intent(); data.putExtra("result", recode); setResult(300, data); finish(); } } }).start(); } }
From source file:br.com.GUI.perfil.PerfilPersonal.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { if (requestCode == 200 || requestCode == 202) { if (requestCode == 200) { selectedImageUri = data.getData(); cortar(requestCode);//from w w w . ja v a 2 s . c o m /*selectedImageUri = Uri.fromFile(photo); ContentResolver cr = getContentResolver(); Bitmap foto; try{ foto = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImageUri); bmp = ImageUtils.compactImages(foto); imagem.setImageBitmap(foto); }catch(FileNotFoundException e){ Log.i("Exception", e.toString()); e.printStackTrace(); } catch (IOException e){ }*/ } else if (requestCode == 202) { //get the returned data Bundle extras = data.getExtras(); //get the cropped bitmap Bitmap foto = extras.getParcelable("data"); bmp = ImageUtils.compactImages(foto); img.setImageBitmap(bmp); Log.i("tirei a foto ", "e setei no canvas"); Personal p = new Personal(); p.setUsuario(pref.getString("usuario", null)); if (p.editarFotoPersonalWeb(ImageUtils.bitmapToByteArray(bmp))) { Log.i("salvei web", "salvei web"); if (p.editarFotoPersonal(b, ImageUtils.bitmapToByteArray(bmp))) { Log.i("salvei local", "salvei local"); refresh(); Toast.makeText(getActivity(), "Atualizada com sucesso!", Toast.LENGTH_SHORT).show(); } } Log.i("setei", "no primeirro"); } } else if (requestCode == 100 || requestCode == 102) { if (requestCode == 100) { selectedImageUri = data.getData(); cortar(requestCode); } else if (requestCode == 102) { //get the returned data Bundle extras = data.getExtras(); //get the cropped bitmap Bitmap foto = extras.getParcelable("data"); bmp = ImageUtils.compactImages(foto); Log.i("tirei a foto ", "e setei no canvas"); Personal p = new Personal(); p.setUsuario(pref.getString("usuario", null)); if (p.editarFotoPersonalWeb(ImageUtils.bitmapToByteArray(bmp))) { Log.i("salvei web", "salvei web"); if (p.editarFotoPersonal(b, ImageUtils.bitmapToByteArray(bmp))) { Log.i("salvei local", "salvei local"); img.setImageBitmap(bmp); Toast.makeText(getActivity(), "Atualizada com sucesso!", Toast.LENGTH_SHORT).show(); } } Log.i("setei", "no primeirro"); refresh(); } /*try { Uri selectedImage = data.getData(); String[] nomeCaminho = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, nomeCaminho, null, null, null); cursor.moveToFirst(); int indexColuna = cursor.getColumnIndex(nomeCaminho[0]); String caminho = cursor.getString(indexColuna); bmp = ImageUtils.compactImages(BitmapFactory.decodeFile(caminho)); imagem.setImageBitmap(BitmapFactory.decodeFile(caminho)); } catch (Exception e) { Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT).show(); Log.e("Camera", e.toString()); } */ } } else { selectedImageUri = null; img.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.profile)); } }
From source file:cn.com.caronwer.activity.AuthSecondActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Uri uri;/*from w ww .jav a2s .co m*/ switch (requestCode) { case REQUEST_CODE_PICK:// ? if (data == null) { return; } uri = data.getData(); if (uri != null) { startPhotoZoom(uri); } break; case REQUEST_CODE_TAKE:// ? if (resultCode == RESULT_CANCELED) { return; } File temp = new File(Environment.getExternalStorageDirectory() + "/" + IMAGE_FILE_NAME[imgType]); uri = Uri.fromFile(temp); System.out.println(uri); if (uri != null) { startPhotoZoom(uri); } break; case REQUEST_CODE_CUTTING:// ??? if (data == null) { return; } else { setPicToView(data); } break; } }
From source file:com.amaze.filemanager.ui.views.drawer.Drawer.java
public void onActivityResult(int requestCode, int responseCode, Intent intent) { if (mainActivity.getPrefs() != null && intent != null && intent.getData() != null) { if (SDK_INT >= Build.VERSION_CODES.KITKAT) { mainActivity.getContentResolver().takePersistableUriPermission(intent.getData(), Intent.FLAG_GRANT_READ_URI_PERMISSION); }//w ww . j a v a2 s. c o m mainActivity.getPrefs().edit() .putString(PreferencesConstants.PREFERENCE_DRAWER_HEADER_PATH, intent.getData().toString()) .commit(); setDrawerHeaderBackground(); } }
From source file:com.anykey.balala.activity.MainActivity.java
public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (resultCode == RESULT_OK) { String path;//www. j av a2 s. co m switch (requestCode) { case CommonResultCode.SET_ADD_PHOTO_CAMERA: path = SharedPreferencesUtil.getInstance(this).getString("picUri", ""); getNewPhoto(path); break; case CommonResultCode.SET_ADD_PHOTO_ALBUM: Uri uri = data.getData(); path = mObtain.getRealPathFromURI(this, uri); getNewPhoto(path); break; case CommonResultCode.SELECT_BAR_CODE: selectBar(); break; default: break; } } }