سلام
من میخوام تو متد bindContact اطلاعات را بگیرم ولی الان نمیدونم چطوری آرایه رو وارد کنم ، بدون bindContact کار میکنه و از Position استفاده میکنم ولی الان تو bindContact گیر کردم.
ممنون.
public class ListContactAdapter extends ArrayAdapter { String []name ; String [] familyName ; int [] proilePics ; Context context ; LayoutInflater inflater ; public ListContactAdapter(@NonNull Context context, String[] name, String[] familyName, int[] proilePics) { super(context, R.layout.mylayout,name); this.name = name; this.familyName = familyName; this.proilePics = proilePics; this.context = context; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { //inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = convertView ; ViewHolder viewHolder = null ; if (row== null) { row = LayoutInflater.from(parent.getContext()).inflate(R.layout.mylayout, parent, false); row.setTag(viewHolder); viewHolder = new ViewHolder(row); } else { viewHolder = (ViewHolder) row.getTag(); } viewHolder.bindContact(proilePics[position],name[position],familyName[position]); //viewHolder.imageView.setImageResource(proilePics[position]); // viewHolder.fName.setText(name[position]); // viewHolder.myName.setText(familyName[position]); return row ; } class ViewHolder extends RecyclerView.ViewHolder { ImageView imageView ; TextView myName ; TextView fName; public ViewHolder(@NonNull View row) { super(row); imageView = row.findViewById(R.id.profile_pic) ; myName = row.findViewById(R.id.name); fName = row.findViewById(R.id.family_name); } public void bindContact(String [] name , String fname , int images) { imageView.setImageResource(images); myName.setText(name()); fName.setText(fname); } } }