-
Notifications
You must be signed in to change notification settings - Fork 499
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
在使用的过程中会报错:An instance of OnFlingListener already set“” #6
Comments
@WUSIR-ShiYan 你好,我的实例代码中没有使用到RecyclerView,你在使用SnapHelper吗,能否给出完整的代码,我好判断是LoadSir的原因还是其它原因。 |
我在一个demo中用在了recyclerview的item点击事件中,第一次点击,正常显示no data的页面,当再次点击该页面就会报这个错误,错误信息如下:
FATAL EXCEPTION: main
Process: com.whp.whp_proj, PID: 8396
java.lang.IllegalStateException: An instance of OnFlingListener already set.
at android.support.v7.widget.SnapHelper.setupCallbacks(SnapHelper.java:114)
at android.support.v7.widget.SnapHelper.attachToRecyclerView(SnapHelper.java:102)
at com.stone.vega.library.VegaLayoutManager.onAttachedToWindow(VegaLayoutManager.java:223)
at android.support.v7.widget.RecyclerView$LayoutManager.dispatchAttachedToWindow(RecyclerView.java:7394)
at android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2490)
at android.view.View.dispatchAttachedToWindow(View.java:15810)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3137)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3145)
at android.view.ViewGroup.addViewInner(ViewGroup.java:4693)
at android.view.ViewGroup.addView(ViewGroup.java:4490)
at android.view.ViewGroup.addView(ViewGroup.java:4431)
at android.view.ViewGroup.addView(ViewGroup.java:4404)
at com.kingja.loadsir.core.LoadLayout.showCallbackView(LoadLayout.java:74)
at com.kingja.loadsir.core.LoadLayout.access$000(LoadLayout.java:20)
at com.kingja.loadsir.core.LoadLayout$1.run(LoadLayout.java:63)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
其中,错误定位到了com.kingja.loadsir.core.LoadLayout.showCallbackView(LoadLayout.java:74),这个是你loadsir那个库里的代码,如下是你的示例程序里的用法,我在回调里面做的处理的该异常:
loadService = LoadSir.getDefault().register(this, new Callback.OnReloadListener() {
@OverRide
public void onReload(View v) {
// Your can change the status out of Main thread.
new Thread(new Runnable() {
@OverRide
public void run() {
loadService.showCallback(LoadingCallback.class);
//do retry logic...
SystemClock.sleep(500);
//我的demo中做的如下处理
if(recyclerView.getOnFlingListener() != null){
recyclerView.setOnFlingListener(null);
}
//callback
loadService.showSuccess();
}
}).start();
}
});
在 2017-09-26 13:11:05,"KingJA" <notifications@github.com> 写道:
@WUSIR-ShiYan 你好,我的实例代码中没有使用到RecyclerView,你在使用SnapHelper吗,能否给出完整的代码,我好判断是LoadSir的原因还是其它原因。
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@WUSIR-ShiYan 可以直接把Demo压缩包发我邮箱吗 |
好的,其实就是RecyclerView最基本的使用,报的这个错误很奇怪,我的demo里也没有使用onFlingListener,在demo里处理一下就可以了
在 2017-09-26 13:49:36,"KingJA" <notifications@github.com> 写道:
@WUSIR-ShiYan 可以直接把Demo压缩包发我邮箱吗
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
从网易163邮箱发来的云附件
DesignMode.rar (25.14M, 2017年10月11日 17:25 到期)
下载
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
loadService = LoadSir.getDefault().register(this, new Callback.OnReloadListener() {
@OverRide
public void onReload(View v) {
// Your can change the status out of Main thread.
new Thread(new Runnable() {
@OverRide
public void run() {
loadService.showCallback(LoadingCallback.class);
//do retry logic...
SystemClock.sleep(500);
The text was updated successfully, but these errors were encountered: