Toga Window widget error on Android #2016
-
At first, I thought the Toga Window widget is an Activity on Android, which is a window that renders the UI. After closing, it returned to the previous window. But on Android, using the Toga Window widget can result in the following errors: Why is this? The code is as follows:
Why did this error occur? If the Window widget cannot be used on Android, how can Toga implement the Android Activity function? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Toga doesn't support additional windows on mobile platforms, because it's not clear what a "Window" would map to. On a desktop, you can have multiple windows visible at any given time, and can add and remove windows arbitrarily; on mobile, you can generally only see one window at a time. On Android specifically, an "Activity" has an entire lifecycle, making it a closer match for Application, not Window. At present, there isn't any support for Android's concept of Activity, beyond the MainActivity. If you want to build your own supplemental activity, you'll need to build it using Chaquopy primitives. |
Beta Was this translation helpful? Give feedback.
If you want your app to contain multiple screens, currently the easiest way is to change the
main_window.content
attribute, which you can do as many times as you like.