Closed jimmy2447 closed 2 years ago
Ok it worked, sorry my fault, I didn't added the project like I supposed to do (I just copied JoystickView java file and other few things from example code and placed directly in my project).
Right way to do is, I placed "implementation 'io.github.controlwear:virtualjoystick:1.10.1'" inside dependencies in 'Build.gradle' file (There are two gradle files with this name, use the one which is inside 'app' directory). After that sync the gradle, next when you add JoystickView in your layout IDE may say it cannot find 'JoystickView' , in that case use the following code in your layout:
<io.github.controlwear.virtual.joystick.android.JoystickView
android:id="@+id/joystickView"
android:layout_width="266dp"
android:layout_height="298dp"
android:layout_marginStart="407dp"
android:layout_marginTop="86dp" />
I added JoystickView java file into my project and some few other things like mentioned here. I added following lines after .oncreate of my Main activity.
Not sure what is the problem here.