I have a custom adapter inheriting from ArrayAdapter<String> . Now I can calmly add my text to the textview , which is in item -e listview . I want to add another textview to the item . The first textview filled with data from one data array, and the second, respectively, from another. After reading a few articles, I realized that for this you can use a HashMap , but how exactly to use it, so that it textview my textview I did not understand. Sorry in advance if something is not clear
Adapter code:
public class MyListAdapter extends ArrayAdapter<String> implements UndoAdapter { private final Context mContext; String items[] = {"item1", "item2", "item3", "item4"}; public MyListAdapter(Context context) { mContext = context; for (int i = 0; i<items.length; i++){ add(items[i]); } } @Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.list_row_dynamiclistview, parent, false); } ((TextView) view.findViewById(R.id.textview1)).setText(getItem(position)); // textview1, куда я могу устанавливать свои значения. ((TextView) view.findViewById(R.id.textView2)).setText("Пока что случайный текст");//textview, куда я хочу устанавливать значения return view; } @NonNull @Override public View getUndoView(final int position, final View convertView, @NonNull final ViewGroup parent) { View view = convertView; if (view == null) view = LayoutInflater.from(mContext).inflate(R.layout.undo_row, parent, false); return view; } @NonNull @Override public View getUndoClickView(@NonNull final View view) { return view.findViewById(R.id.undo_row_undobutton); } @Override public long getItemId(final int position) { return getItem(position).hashCode(); } @Override public boolean hasStableIds() { return true; } } Thank)