twotoasters/JazzyListView

setVerticalScrollBarEnabled(true) causes null pointer exception

djj0809 opened this issue · 2 comments

The constructor originally looks like:

    public JazzyListView(Context context) {
        this(context, null);
    }

    public JazzyListView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public JazzyListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        mHelper = new JazzyHelper(context, attrs);
        super.setOnScrollListener(mHelper);
    }

Maybe it should be like this:

    public JazzyListView(Context context) {
        super(context);
        mHelper = new JazzyHelper(context, null);
        super.setOnScrollListener(mHelper);
    }

    public JazzyListView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mHelper = new JazzyHelper(context, attrs);
        super.setOnScrollListener(mHelper);
    }

    public JazzyListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        mHelper = new JazzyHelper(context, attrs);
        super.setOnScrollListener(mHelper);
    }

It seems that you passed 0 to the defStyle causes this problem

good catch, thanks!

thanks for catching this. this should be fixed now