You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement the second example (Recipe 2 RecyclerView with Advanced ads) but I run into the following Issues:
RecyclerExampleAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.ListView;
import com.clockbyte.admobadapter.ViewWrapper;
import java.util.ArrayList;
import java.util.List;
public class RecyclerExampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<String> items = new ArrayList<String>();
private Context mContext;
public RecyclerExampleAdapter(Context context){
mContext = context;
}
@Override
public viewGroup onBindViewHolder(ViewWrapper<RecyclerViewExampleItem> viewHolder, int position) {
RecyclerViewExampleItem rvei = viewHolder.getView();
String str = getItem(position);
rvei.bind(str);
}
@Override
public int getItemCount() {
return items.size();
}
@Override
protected RecyclerViewExampleItem onCreateItemView(ViewGroup parent, int viewType) {
RecyclerViewExampleItem rvei = new RecyclerViewExampleItem(mContext);
return rvei;
}
@Override
public String getItem(int position) {
return items.get(position);
}
public void addAll(List<String> lst){
items.addAll(lst);
}
}
RecyclerViewExampleItem.java
import android.content.Context;
import android.widget.FrameLayout;
import android.widget.TextView;
public class RecyclerViewExampleItem extends FrameLayout {
TextView tvText;
public RecyclerViewExampleItem(Context context) {
super(context);
//inflate(context, R.layout.recyclerview_item, this);
//tvText = ((TextView) findViewById(R.id.tvText));
}
public void bind(String str){
tvText.setText(str); //publishing the text from you data collection to each item in the RecyclerView
}
}
Gives:
Class 'RecyclerExampleAdapter' must either be declared abstract or implement abstract method 'onBindViewHolder(VH, int)' in 'Adapter
Method does not override method from its superclass for public viewGroup onBindViewHolder
Method does not override method from its superclass for protected RecyclerViewExampleItem onCreateItemView
Method does not override method from its superclass for public String getItem
If I let Android Studio generate the methods I get:
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
}
What am I missing?
The text was updated successfully, but these errors were encountered:
I am trying to implement the second example (Recipe 2 RecyclerView with Advanced ads) but I run into the following Issues:
RecyclerExampleAdapter.java
RecyclerViewExampleItem.java
Gives:
public viewGroup onBindViewHolder
protected RecyclerViewExampleItem
onCreateItemViewpublic String getItem
If I let Android Studio generate the methods I get:
What am I missing?
The text was updated successfully, but these errors were encountered: