GeorgePashev_88

Untitled

Apr 19th, 2023
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. protected class ElementAdapter
  2.     extends ArrayAdapter<Element>{
  3.  
  4.  
  5.         public ElementAdapter(@NonNull Context context,  @NonNull List<Element> objects) {
  6.             super(context, 0, objects);
  7.         }
  8.         @Override
  9.         public View getView(int position, View convertView, ViewGroup parent){
  10.             Element dataModel = getItem(position);
  11.             View currentItemView = convertView;
  12.             if(currentItemView == null){
  13.                 currentItemView = LayoutInflater.from(getContext())
  14.                         .inflate(R.layout.activity_list_view_fragment,
  15.                                 parent, false
  16.                                 );
  17.             }
  18.  
  19.             TextView textViewName = currentItemView.findViewById(R.id.textViewName);
  20.             textViewName.setText(dataModel.Name);
  21.  
  22.             TextView textViewID = currentItemView.findViewById(R.id.textViewID);
  23.             textViewID.setText(dataModel.ID);
  24.  
  25.             TextView textViewTel = currentItemView.findViewById(R.id.textViewTel);
  26.             textViewTel.setText(dataModel.Tel);
  27.  
  28.             TextView textViewEmail = currentItemView.findViewById(R.id.textViewEmail);
  29.             textViewEmail.setText(dataModel.Email);
  30.             return currentItemView;
  31.  
  32.  
  33.         }
  34.  
  35.  
  36.     }
Add Comment
Please, Sign In to add comment