Android 5.1 PythonActivity.mActivity Stuck
@331319341 so, we have the log, that's good, but it's not complete (the log should end with Python for android ended or something like that). What we don't have is what's wrong with it or at least some code that could reproduce it. Buildozer/P4A files used for creating the APK would be nice too. Please include the requested stuff :)
from jnius import cast from jnius import autoclass
import the needed Java class
PythonActivity = autoclass('org.renpy.android.PythonActivity') Intent = autoclass('android.content.Intent') Uri = autoclass('android.net.Uri')
create the intent
intent = Intent() intent.setAction(Intent.ACTION_VIEW) intent.setData(Uri.parse('http://kivy.org'))
PythonActivity.mActivity is the instance of the current Activity
BUT, startActivity is a method from the Activity class, not from our
PythonActivity.
We need to cast our class into an activity and use it
currentActivity = cast('android.app.Activity', PythonActivity.mActivity) currentActivity.startActivity(intent)
The website will open.
