发送捆绑与明确的意图 [英] Sending bundle with Explicit Intents
本文介绍了发送捆绑与明确的意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的库项目发送和意向到我的工作项目(贴有与它的库)。在这里,我打电话给我的活动从我的库项目是这样的:
I want to send and Intent from my library project to my working project (that has that library attached with it.). Here I am calling my activity from my library project like this:
Intent intent = new Intent("isr.LAUNCH");
intent.setComponent(new ComponentName("com.abc.def", "com.abc.def.screens.BaseActivity_New"));
intent.putExtra("selectedbook_id",MyReader.BOOK_ID );
intent.putExtra("isReaderSample", MyReader.IS_SAMPLE);
intent.putExtra("landing_fragment", "reader_backtrack");
MyReader.activity.startActivity(intent);
MyReader.activity.finish();
这是我如何BaseActivity_New提取束:
This is how I am extracting bundle in BaseActivity_New:
bundle = getIntent().getExtras();
活动,正确地解雇,但束始终为空,当我在BaseActivity_New的OnResume并检查我BaseActivity的启动模式是singleInstance
任何人都可以请帮我如何使用显式意图送包。
Can anyone please help me how to send bundle with Explicit Intents.
感谢
推荐答案
由于其是singleInstance我刚才看到你编辑的答案。
As its is singleInstance I just see you edit the answer.
覆盖此方法
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
//now getIntent() should always return the last received intent
}
这篇关于发送捆绑与明确的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文