使用 getextra 方法时总是得到空值,我在一个活动上添加额外内容并在另一个活动上接收,我的代码是
super.onActivityResult(requestCode, resultCode, data);
String filePath="";
Intent intent1 = new Intent(TagActivity.this,AddnewNoteActivity.class);
if(requestCode==1)
{
}
else if(requestCode==2)
{
if(resultCode == RESULT_OK)
{
intent1.putExtra("path", data.getData());
intent1.setType("image/*");
}
}
else if(requestCode==3)
{
if(resultCode == RESULT_OK){
intent1.putExtra("path", data.getData());
intent1.setType("audio/*");
}
}
startActivity(intent1);
}
在接收方
if(imageUri==null)
{
extras = getIntent().getExtras();
if (extras != null) {
String Path;
Path= extras.getString("path");
imageUri = Uri.parse(Path);
}
}
Nuth 每次在 Path 中收到 null,请帮忙