我跟着Lukaspili Demo为电机创建MVP架构项目&流程框架集成。我想在登录后登录&之前进行两项不同的活动。我无法获取父活动实例来创建新的Intent(ParentActivity.this,NewActivity.class)。有没有人遇到这种情况?Square up FLOW navigation
回答
您应该能够获得您的视图的base context
活动。
public static Activity getActivity(Context context) {
if(context instanceof Activity) {
return (Activity) context;
} else if(context instanceof ContextWrapper) {
Context baseContext = ((ContextWrapper) context).getBaseContext();
if(baseContext instanceof Activity) {
return (Activity) baseContext;
}
}
Log.e(TAG, "No activity could be found in [" + context + "]");
throw new IllegalStateException("No activity could be found in [" + context + "]");
}
演示者只保存视图上下文。因此我们不能通过上述方法获得活动上下文。我们需要通过Dagger作用域实现..但是,我正在努力获得它 – Jeyahariprakash
您应该能够使用此方法从View上下文中提取Activity上下文。请尝试。但是,如果基本上下文是**不是**一个活动,那么我会尝试找出一些东西。此方法在Flow 1.0.0-alpha中不起作用。 – EpicPandaForce
我只使用Flow 0.12。我收到错误消息“无法在[[email protected]]中找到活动”。 – Jeyahariprakash
- 1. spinner did nott up up
- 2. android:alarm not wake up up
- 3. Label is not up up
- 4. matlab input-output:convert square inches to square cm?
- 5. jquery navigation
- 6. Autowire on new-up up object
- 7. Java boolean if-statement up up
- 8. notfiy-send not up up with upstart
- 9. Google Website Translator up up HTML
- 10. square Facebook图片
- 11. FloatingActionButton Shadow by Square
- 12. Java Square函数
- 13. Android - Square TableLayout
- 14. Javascript Square Multi Array
- 15. android activity stack-back navigation
- 16. ICommand with navigation
- 17. Java Record Navigation
- 18. Bootstrap Navigation mobile - wordpress
- 19. iOS App navigation
- 20. Tabkey navigation HTML
- 21. CSS dropdown navigation
- 22. AS web navigation
- 23. Flexslider bulete navigation
- 24. views navigation prism
- 25. React Native Stack Navigation
- 26. iptables:选择pre-up/up/post-up rsp的原因。 pre-down/down/down-
- 27. Normal Magic Square(By Loop)
- 28. Square-Connect TransactionId长度
- 29. Four Square的OAuth API
- 30. Square PoS Android Web auto_return
哪个版本的Flow? 1.0.0-alpha或0.12? – EpicPandaForce
哦,它是流量0.10。这是一段时间以前...让我想出来 – EpicPandaForce
@EpicPandaForce:它的流0.12 – Jeyahariprakash