timqi/SectorProgressView

how to change color in listview?

sum1re opened this issue · 1 comments

I use it in the listview, but when i try to change color, it throws exception.

java.lang.NullPointerException: Attempt to read from field 'float android.graphics.RectF.left' on a null object reference
at com.timqi.sectorprogressview.ColorfulRingProgressView.setFgColorStart(ColorfulRingProgressView.java:138)

here is my code

@BindColor(R.color.yellow) int yellow;
@BindColor(R.color.red) int red;
List<timeUtils> data;

public View getView(int i, View view, ViewGroup viewGroup) {
        view = inflater.inflate(R.layout.view_list_details, viewGroup, false);
        ViewHolder viewHolder = new ViewHolder(view);
timeUtils time = data.get(i);
        float present = time.getPresent();
        if (present >= 50) {
            viewHolder.crp.setFgColorStart(yellow);
            viewHolder.crp.setFgColorEnd(red);
        }
        viewHolder.crp.setPercent(present);
        return view;
}

Is there anything to help me solve the problem?

timqi commented

seems that variable mOval need to be initialize in function init()