hi i am not able to getting call to method onActivityResult after below code.
private void ImageChooseOptionDialog() { Log.i(TAG, "Inside ImageChooseOptionDialog"); String[] photooptionarray = new String[] { "Take a photo", "Choose Existing Photo" }; Builder alertDialog = new AlertDialog.Builder(TabSample.tabcontext) .setItems(photooptionarray, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == 0) { Log.i(TAG, "Which" + which); Log.i(TAG, "Inside ImageChooseOptionDialog Camera"); _path = Environment .getExternalStorageDirectory() + File.separator + "TakenFromCamera.png"; Log.d(TAG, "----- path ----- " + _path); media = _path; // File file = new File(_path); // Uri outputFileUri = Uri.fromFile(file); // Intent intent = new Intent( // android.provider.MediaStore.ACTION_IMAGE_CAPTURE); // intent.putExtra(MediaStore.EXTRA_OUTPUT, // outputFileUri); // startActivityForResult(intent, 1212); } else if (which == 1) { Log.i(TAG, "Which" + which); Log.i(TAG, "Inside ImageChooseOptionDialog Gallary"); // Intent intent = new Intent(); // intent.setType("image/*"); // intent.setAction(Intent.ACTION_GET_CONTENT); // startActivityForResult(Intent // .createChooser(intent, // "Select Picture"), 1); Intent intent = new Intent( Intent.ACTION_GET_CONTENT); intent.setType("image/*"); // intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent .createChooser(intent, "Select Picture"), 1); Log.i(TAG, "end" + which); } } }); alertDialog.setNeutralButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.create().show(); } and this is my onActivityResult method:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(TAG, "Inside Onactivity Result"); if (resultCode == RESULT_OK) { if (requestCode == 1) { Log.i(TAG, "Inside if else Onactivity Result"); // currImageURI is the global variable I’m using to hold the // content:// URI of the image Uri currImageURI = data.getData(); String path = getRealPathFromURI(currImageURI); Log.i(TAG, "Inside Onactivity Result Image path" + path); } } } please let me knew where i am doing wrong. i am calling onActivityResult method from which=1 after dialog box appears. but not getting any log inside onActivityResult method in logcat.