setOnBannerListener点击无效,没有回调

c0vxltue  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(182)

轮播图有数据正常滚动,但是setOnBannerListener点击没有回调相应
binding.homeBanner.setAdapter(new HomeBannerAdapter(homeBannerEntities));
binding.homeBanner.setOnBannerListener(new OnBannerListener() {
@OverRide
public void OnBannerClick(Object data, int position) {
if(null!= data){
HomeBannerEntity entity = (HomeBannerEntity) data;
if(entity.getIsNeedToken()==1){
String token = UserCenter.getInstance().getToken();
if (StringUtils.isEmpty(token)) { //未登录
startActivity(LoginActivity.class);
return;
}
}
Bundle bundle = new Bundle();
Intent intent = new Intent();
if(entity.getContentType()==1){
//跳转到帖子
// bundle.putInt("topicId", Integer.valueOf(entity.get().getTopicId()));
// intent.putExtras(bundle);
}else{
//跳转到H5页面
if (entity.getH5Title() != null && entity.getH5Url() != null) {
bundle.putString("title", entity.getH5Title());
bundle.putString("url", entity.getH5Url());
startActivity(InternalTokenWebActivity.class, bundle);
}
}

}
                }
            });
xzlaal3s

xzlaal3s1#

implementation 'io.github.youth5201314:banner:2.2.2' 引用的事该版本

相关问题