It wraps your Adapter to display Admob native ads and banners in a ListView/RecyclerView data set. It based on the Yahoo fetchr project https://github.com/yahoo/fetchr
Apache License 2.0
236
stars
75
forks
source link
RecyclerAdapter can not be converted to Adapter<ViewHolder> error #81
I'm trying to use the AdmobAdapter library to show natives ads inside my recyclerview. But it's giving me some errors. So here is my adapter class,
public class PostFeedAdapter extends RecyclerView.Adapter<PostFeedAdapter.ViewHolder>{
Context c;
public PostFeedAdapter(Context c) {
this.c = c;
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView caption;
public ViewHolder(View itemView) {
super(itemView);
caption = (TextView)itemView.findViewById(R.id.caption);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from (parent.getContext ()).inflate (R.layout.post_card, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 10;
}
}
And in my Fragment, I'm using the AdmobAdapter
adapterWrapper = new AdmobExpressRecyclerAdapterWrapper(getActivity(), Arrays.asList(presets), testDevicesIds);
list.setItemAnimator(new DefaultItemAnimator());
PostFeedAdapter adapter = new PostFeedAdapter(getActivity());
adapterWrapper.setAdapter(adapter);
adapterWrapper.setNoOfDataBetweenAds(10);
adapterWrapper.setFirstAdIndex(2);
list.setAdapter(adapterWrapper);
But it's giving my errors,
Error:(94, 35) error: incompatible types: PostFeedAdapter cannot be converted to Adapter<ViewHolder>
I'm trying to use the AdmobAdapter library to show natives ads inside my recyclerview. But it's giving me some errors. So here is my adapter class,
And in my Fragment, I'm using the AdmobAdapter
But it's giving my errors,