I tried the Qt forums but with no avail. I'm trying to develop an Android application that one of the functionality is changing the brightness of the tablet backlight. I have successfully written two programs in Android Studio (in Java) using the LayoutParams and Android putInt
system brightness to change brightness. The issue comes when I try to move the code to my Qt application. I have the JNI code working and it runs my functions, but when I paste the brightness code in to change brightness method the application fails.
From what I understand of Android and the error statements, my issue (I think) is I am not running the code on the UI thread. I've tried to force my Java method to be a Runnable and use runonUiThread
but that doesn't support the ContentResolver
or Window because it is not an Activity.
Does anyone have experience with this that can guide me? Or have any experience getting anything in the Android settings to work?
I appreciate everyone helping out, Andrew
You could have it in a static Java method like :
You can then call this static Java function from your C++ code :
Here you pass a value between
1
and255
to the function.