onNewIntent() is not called in android Tabs

左心房为你撑大大i 提交于 2019-12-19 03:45:31

问题


I am working on one application. In my application I have three tabs. In the 3rd tab I have implemented some LinkedIn integration using their SDK, so that user can share on his LinkedIn account wall.

Everything seems to be working fine if I don't use this code inside tabs. But if I integrate the code that uses the LinkedIn SDK inside tabs, then onNewIntent() is not fired.

I am integrating LinkedIn like this:

        Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(liToken.getAuthorizationUrl()));
        i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        startActivity(i);

It basically opens a web page and when comes back it restarts my previous activity from where i called the LinkedIn SDK, but having no tabs at the bottom.

I want my app to come to my previous activity, and onNewIntent() should be called even when my code is moved inside tabs. How can I achieve it?

Thanks


回答1:


Set your activitys launchMode="singleTop" in the AndroidManifest.xml instead?




回答2:


I found that onNewIntent will be called as described in documentation if both launchMode="singleTop" and Intent.FLAG_ACTIVITY_SINGLE_TOP are setted.



来源:https://stackoverflow.com/questions/8800006/onnewintent-is-not-called-in-android-tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!