ここで問題が発生しています。データのバインドでは、パブリックオブジェクトは使用できません。私は他のクラスからデータを取得し、テキストをXMLに設定するクラスを作成することになっていました。RecyclerView onBind、データバインディングなし
public class EventsAdapter extends
RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List<LauncherActivity.ListItem> listItems;
private Context context;
public EventsAdapter(List<LauncherActivity.ListItem> listItems, Context context) {
this.listItems = listItems;
this.context = context;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.event_list, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
LauncherActivity.ListItem listItem = listItems.get(position);
holder.
}
@Override
public int getItemCount() {
return listItems.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView textHeading = null;
public TextView textDescription = null;
public ViewHolder(View itemView) {
super(itemView);
textHeading = (TextView)itemView.findViewById(R.id.viewHead);
textDescription = (TextView)itemView.findViewById(R.id.viewDesc);
}
}
}
コードをテキストとして追加してください。 –
確かに質問のコードを貼り付けるよりもスクリーンショットをアップロードする方が難しいです。あなたのコードを手に入れて編集して答えを出すことができる人を考えたことがありますか? –
私は質問を編集してください:) – prazeev