Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected class ElementAdapter
- extends ArrayAdapter<Element>{
- public ElementAdapter(@NonNull Context context, @NonNull List<Element> objects) {
- super(context, 0, objects);
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent){
- Element dataModel = getItem(position);
- View currentItemView = convertView;
- if(currentItemView == null){
- currentItemView = LayoutInflater.from(getContext())
- .inflate(R.layout.activity_list_view_fragment,
- parent, false
- );
- }
- TextView textViewName = currentItemView.findViewById(R.id.textViewName);
- textViewName.setText(dataModel.Name);
- TextView textViewID = currentItemView.findViewById(R.id.textViewID);
- textViewID.setText(dataModel.ID);
- TextView textViewTel = currentItemView.findViewById(R.id.textViewTel);
- textViewTel.setText(dataModel.Tel);
- TextView textViewEmail = currentItemView.findViewById(R.id.textViewEmail);
- textViewEmail.setText(dataModel.Email);
- return currentItemView;
- }
- }
Add Comment
Please, Sign In to add comment