我跟着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