Help me [Context error]

I want to know what is the problem ?

Error :

'HorizontalWheelView(, ohos.agp.components.AttrSet)' in 'com.github.shchurov.horizontalwheelview.HorizontalWheelView' cannot be applied to '(android.content.Context)'
private final Context context;

  public myAix(ComponentContainer container) {

    context = container.$context();

 @SimpleFunction(description = "")
  public void MyFun() {
    HorizontalWheelView myView = new HorizontalWheelView(context);

try this

There might be a silly mistake because I wrote this without idle :slight_smile:

1 Like

This will not work. If you are working with this library, you have to pass two parameters to create a HorizontalWheelView object, Context & AttributeSet. You should modify the library or maybe passing a null AttributeSet work.


horizontalWheelView = new HorizontalWheelView(this.context, null);

I think you have already messed up with HorizontalWheelView class, (I am assuming you are using this library).Add these imports in that class.

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import static java.lang.Math.PI;
1 Like

hello @oseamiya
Sorry for the late reply, but the error is still there

I was already intending to use it but I didn’t know how to extract the jar file from it
So I searched on Maven and found this library:

Hello @Shreyaa I already tried it but it didn’t work

This is not an android library. That’s why error is showing.

1 Like

Download the source code of the library and use them .

Is there no other way?
Because it often shows me some mistakes
If there is another way to convert it to a jar file, it would be better

Download source code of original android library from here :

Then if you are using rush, unzip this file inside src folder. Delete that har dependency you put on your deps folder.

1 Like

Okay thanx , I will try it soon

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.