How to show an Alert Dialog on Android with jnius

Viewed 6

I'm trying to show a simple dialog on Android with jnius.
I did first try the following :

AlertDialog = autoclass('android.app.AlertDialog')

and then use the builder to build it :

PythonActivity = autoclass('org.renpy.android.PythonActivity')
ctx = cast('android.content.Context', PythonActivity.mActivity)
AlertDialog.Builder(ctx).setTitle("Title").setMessage("Message").show()

However, jnius says AlertDialog does not have Builder. So, I tried by another way :

AlertDialogBuilder = autoclass('android.app.AlertDialog$Builder')
AlertDialogBuilder(ctx).setTitle("Title").setMessage("Message").show()

However, It still doesn't work "jnius.jnius.JavaException: No methods matching your arguments"
What I am doing wrong ? I checked and did not mispelled any method names.

0 Answers
Related