此代码启动活动:
Intent intent = new Intent(context, GameActivity.class);
intent.putExtra("load", true);
startActivity(intent);
这是我尝试获得新活动的意图的方法:
private Intent intent = this.getIntent();
有人告诉我尝试包括以下内容:
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
但这无济于事。在几次崩溃之后,我添加了:
if (intent == null) Log.w("Intent", "Intent is null");
我究竟做错了什么?
private Intent intent = this.getIntent();
通话getIntent()
中onCreate
或在生命周期的另一个回调。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句