简体   繁体   English

跳过两者之间的活动并达到android中的特定活动

[英]Skip the activities in between and reach the specific activity in android

I have following app structure 我有以下应用程序结构

  • MainFragmentActivity MainFragmentActivity
    • Notification Fragment 通知片段
    • MainFragment MainFragment
    • ChatFragment ChatFragment
    • So on etc. 依此类推

I also have set a broadcast on all "Activities" That will show a popup if any Push notification is arrived. 我还为所有“活动”设置了广播,如果收到任何“推送”通知,都会显示一个弹出窗口。

The popup has two options, View or Ok. 弹出窗口有两个选项,“查看”或“确定”。

Now let's say i am on ChatFragment , from there i go to Chat Contacts List ( Activity) Then on a ChatScreen(Activity) then on ProfileScreen(Activity) of User 现在,假设我在ChatFragment上,从那里转到“聊天联系人列表”(活动),然后在ChatScreen(Activity)上,然后在User的ProfileScreen(Activity)上

The Stack of Activities will be like 活动堆栈会像

MainFragmentActvity -> ChatContactsList -> ChatScreen -> ProfileScreen

What i want is, when i click on "View" on ProfileScreen it should remove all stack activities and take back to MainFragmentActivity and replace its Current Fragment with NotificationFragment. 我想要的是,当我在ProfileScreen上单击“查看”时,它应该删除所有堆栈活动,并返回MainFragmentActivity,并用NotificationFragment替换其Current Fragment。

I can do finishAffinity() Restart the app and put MainFragment but i want to support 16- APIS to. 我可以做finishAffinity()重新启动应用程序,然后将MainFragment放进去,但是我想支持16 APIS。

Flag Clear Top will remove MainActivity and i do not want to restart it because then it has to call a lot of apis Flag Clear Top将删除MainActivity,并且我不想重新启动它,因为那样的话它必须调用很多api

I do not want to put NO History FLAG because i need to put All other activities in History. 我不想放任何NO History FLAG因为我需要将所有其他活动都放入历史记录。 What can i do here . 我在这里能做什么。

Also i do not want to put startActivityForResult it would be so complex. 我也不想把startActivityForResult放得太复杂了。 Any ideas would be appreciated 任何想法,将不胜感激

What I understood from your explaination is, you want to create wizard like scenario to control the activities flow at run time. 通过您的解释,我了解到,您想创建类似方案的向导来控制运行时的活动流。 (Wizard means, for example, installation window(wizard) of application on microsoft windows) (向导表示,例如,Microsoft Windows上应用程序的安装窗口(向导))

  1. For that, there is already developed library by Nimrod Dayan , called WizarDroid . 为此, Nimrod Dayan已经开发了一个名为WizarDroid的库。

    Here is the link for home page of the same, WizarDroid 这是相同的WizarDroid主页的链接

    Try it out, its good. 试试看,它很好。

or 要么

  1. You can use view pager (WizarDroid is also built on view pager) 您可以使用视图寻呼机 (WizarDroid也基于视图寻呼机构建)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM