在适配器Gridlayout上实现Adclose插页式广告?

时间:2019-05-19 09:17:22

标签: java android

我尝试在适配器上实现Adclose插入,但是我遇到了一些问题。

这是我的案例图片

这是我的代码为textview附加

   viewHolder.rvList.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
    ExploreInnerListAdapter adapter = new ExploreInnerListAdapter(context, model.getStickerPack());
    adapter.setClickListener(new ExploreInnerListAdapter.ClickListener() {
        @Override
        public void onClick(View v, int position) {
            try {
                admobAdsClass.showIntrestrialAds(context, new admobCloseEvent() {
                    @Override
                    public void setAdmobCloseEvent() {
                        int innerPos = (int) v.getTag();
                        StickerPack stickerPack = model.getStickerPack().get(innerPos);
                        stickerPack.setDefaultPack(true);
                        Intent intent = new Intent(context, StickerPackDetailsActivity.class);
                        intent.putExtra(GlobalFun.KeyDetailStickersList, stickerPack.tojson());
                        context.startActivity(intent);
                    }
                });
            } catch (Exception e) {
                int innerPos = (int) v.getTag();
                StickerPack stickerPack = model.getStickerPack().get(innerPos);
                stickerPack.setDefaultPack(true);
                Intent intent = new Intent(context, StickerPackDetailsActivity.class);
                intent.putExtra(GlobalFun.KeyDetailStickersList, stickerPack.tojson());
                context.startActivity(intent);
            }
        }
    });

这个带有onclick网格的Myproblem,不显示广告插页式广告,只需进行第二次活动

GridLayoutManager mLayoutManagerCalls = new GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false);
    viewHolder.recyclerGrid.setLayoutManager(mLayoutManagerCalls);
    viewHolder.recyclerGrid.setHasFixedSize(true);
    exploreInnerItemGridAdapter = new ExploreInnerItemGridAdapter(context, stickerPack.get(i).getStickers(), new View.OnClickListener() {
        @Override
        public void onClick(View v ) {
            try {
                admobAdsClass.showIntrestrialAds(context, new admobCloseEvent() {
                    @Override
                    // The interstitial not display after clicked the adapter
                    public void setAdmobCloseEvent() {
                        int i = (int) v.getTag();
                        StickerPack stickerPackModel = model.getStickerPack().get(i);
                        stickerPackModel.setDefaultPack(true);
                        Intent intent = new Intent(context, StickerPackDetailsActivity.class);
                        intent.putExtra(GlobalFun.KeyDetailStickersList, stickerPackModel.tojson());
                        context.startActivity(intent);
                    }
                });
            } catch (Exception e) {
                StickerPack stickerPackModel = stickerPack.get(i);
                stickerPackModel.setDefaultPack(true);
                Intent intent = new Intent(context, StickerPackDetailsActivity.class);
                intent.putExtra(GlobalFun.KeyDetailStickersList, stickerPackModel.tojson());
                context.startActivity(intent);
            }
        }
    });

0 个答案:

没有答案