好奇,如果我可以调用某些第三方活动,然后在onActivityResult中读取我原来的意图数据.
我对我来说没有任何意义,真的......无论如何,由于它将onActivityResult始终是启动第 3 方活动的同一部分的一部分,Activity您只需将该数据保存在您的活动中的某个位置即可。例如:
private Intent intentForThat3rdPartyActivity = null; // long name, huh?
public void hereYouLaunchThings(){
if( intentForThat3rdPartyActivity == null ){
intentForThat3rdPartyActivity = new Intent(YourActitity.this, The3rdPartyActivity.class);
intentForThat3rdPartyActivity.putExtra("weird", "data");
}
startActivityForResult(intentForThat3rdPartyActivity, 9999);
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
// this should have the same data you passed
String foo = intentForThat3rdPartyActivity.getStringExtra("weird");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1300 次 |
| 最近记录: |