protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && requestCode == PICK_IMAGE) { Uri imageUri = data.getData(); imageView.setImageURI(imageUri); } if (resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); File f = new File("" + selectedImageUri); String s = getRealPathFromURI(selectedImageUri); f.getName(); TextView tv= (TextView) findViewById(R.id.textView); tv.setText(s); } } public String getRealPathFromURI(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; @SuppressWarnings("deprecation") Cursor cursor = managedQuery(uri, projection, null, null, null); int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)