I was use this code on button onClick for pick image from gallary
I want to pass string from intent using putExtra and from the same activity, i try to get this value from onActiviryResult using getExtra but i am getting null vlaue. Is this any way to getting string value which i passed using intent, and this intent open gallery to pick image then return back to same activiy i want to get that string which i passed in intent.
Intent intent = new Intent();
intent.setType("image/");
intent.setAction(Intent.ACTION_PICK);
intent.putExtra("image_field_tag", field_tag);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), Integer.parseInt(fieldDetlKey));
from above code intent.putExtra("image_field_tag", field_tag);
value i am getting null value in onActivityResult see the below code
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
Bundle bundle = data.getExtras();
String imgTag = bundle.getString("image_field_tag");
Log.d("image Tag", imgTag);
Log.d("requestCode",""+requestCode);
Log.d("resultCode", ""+resultCode);
}
I am getting the null value of variable imgTag, Please tell me how to get extra value from onActivityResult
Thanx,
when we want a result to be returned by the child activity, we need to call it by the method startActivityForResult(). When the child activity finishes with the job, it should set the data in an intent and call the method setResult(resultcode, intent) to return the data through the intent.
For Detail .Refer this tutorial
http://saigeethamn.blogspot.in/2009/08/android-developer-tutorial-for_31.html