我正在将一个来自Activity-A的上下文传递给一个页面适配器,在适配器内部,我正在传递一个意图来进行通话
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + number));
intent.putExtra("id",listId.toString());
context.startActivityForResult(intent, 105);
Activity A从另一个Activity B继承而来,在基础的Activity B内部,定义了onActivityResult:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == 104) {
if (GetLocation.isLocationEnabled(this)) {
<my codes>
}
}
}
在 Activity A 中,我有一个 onActivityResult 方法:
@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");
}
}
我总是得到一个空值的user_Id,有人能帮我解决这个问题吗?