Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVLoadingIndicatorView无法在代码里动态构造问题 #47

Closed
JackRo opened this issue Aug 11, 2016 · 3 comments
Closed

AVLoadingIndicatorView无法在代码里动态构造问题 #47

JackRo opened this issue Aug 11, 2016 · 3 comments

Comments

@JackRo
Copy link

JackRo commented Aug 11, 2016

BallBeatIndicator ballBeatIndicator = new BallBeatIndicator(); AVLoadingIndicatorView avLoadingIndicatorView = new AVLoadingIndicatorView(this); avLoadingIndicatorView.setIndicator(ballBeatIndicator); avLoadingIndicatorView.setIndicatorColor(0xffffff);

我这里动态构造抛出下面的异常

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.wang.avi.Indicator.setColor(int)' on a null object reference

是因为AVLoadingIndicatorView在构造函数里没给indicatorName一个默认值:

String indicatorName=a.getString(R.styleable.AVLoadingIndicatorView_indicatorName); int indicatorColor=a.getColor(R.styleable.AVLoadingIndicatorView_indicatorColor, Color.WHITE); setIndicator(indicatorName); //这里没有默认值 setIndicatorColor(indicatorColor); //导致这里空指针异常

@HarlonWang
Copy link
Owner

好的,我检查一下。

HarlonWang added a commit that referenced this issue Aug 11, 2016
@HarlonWang
Copy link
Owner

已修复,希望你可以帮我测试一下。你需要更新至最新版本compile 'com.wang.avi:library:2.1.2' ,如有问题,欢迎告诉我,谢谢 @JackRo

@ProZoom
Copy link

ProZoom commented Apr 22, 2018

最新版2.1.3又有这个问题了!降为2.1.2没问题,最新版怎么回事呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants