I am passing a context from an activity-A to a page adapter and inside that adapter i am passing an intent to make a call
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + number));
intent.putExtra("id",listId.toString());
context.startActivityForResult(intent, 105);
The Activity A is inherited from another Activity B and inside that base Activity B, onActivityResult is defined as:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == 104) {
if (GetLocation.isLocationEnabled(this)) {
<my codes>
}
}
}
Inside Activity A i am having onActivityResult as:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == 105) {
Bundle extras=getIntent().getExtras();
String user_Id=extras.getString("id");
}
}
I am always getting a null value for user_Id, Can anyone help me on this issue?
use intent.getExtras()
instead of getIntent().getExtras()
getIntent()
will get you the intent
which launched your activity originally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With