Skip to content Skip to sidebar Skip to footer

I Can't Use Api Reflection On Androidx.appcompat:appcompat:1.1.0

I have a problem with androidx.appcompat:appcompat:1.1.0. It's a new problem because on androidx.appcompat:appcompat:1.0.2 it does not exist. I have a code that uses reflection to

Solution 1:

Everybody.

I was able to do it.

First, i put the spinner on the activity with java code. "programatically".

publicvoidinitTest(){
    spinner2 = newSpinner(this, Spinner.MODE_DROPDOWN);
    spinner2.setAdapter(newArrayAdapter(this, R.layout.spinner_item, datos));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        spinner2.setId(spinner2.generateViewId());
    }

    ConstraintLayoutparentLayout= (ConstraintLayout)findViewById(R.id.main_activity);
    parentLayout.addView(spinner2, 0);

    ConstraintSetcs=newConstraintSet();
    cs.clone(parentLayout);
    cs.setHorizontalBias(spinner2.getId(), 0.473F);
    cs.setVerticalBias(spinner2.getId(), 0.484F);
    cs.connect(spinner2.getId(), ConstraintSet.BOTTOM, parentLayout.getId(),ConstraintSet.BOTTOM);
    cs.connect(spinner2.getId(), ConstraintSet.START, parentLayout.getId(),ConstraintSet.START);
    cs.connect(spinner2.getId(), ConstraintSet.TOP, parentLayout.getId(),ConstraintSet.TOP);
    cs.connect(spinner2.getId(), ConstraintSet.END, parentLayout.getId(),ConstraintSet.END);
    // cs view id, else getId() returns -1// connect start and end point of views, in this case top of child to top of parent.// ... similarly add other constraints
    cs.applyTo(parentLayout);

}  

Then i call the code put at the beginning in my question.

I hope it works for many people, and to skip this error of the new version.

Regards.

Post a Comment for "I Can't Use Api Reflection On Androidx.appcompat:appcompat:1.1.0"