-
Notifications
You must be signed in to change notification settings - Fork 0
/
PostAdapter.java
62 lines (39 loc) · 1.74 KB
/
PostAdapter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.example.pet1;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
public class PostAdapter extends ArrayAdapter {
private Activity context;
private List<Posts>ilanlarList;
public PostAdapter(Activity context, List<Posts>ilanlarList){
super(context, R.layout.activity_post_adapter, ilanlarList);
this.context=context;
this.ilanlarList=ilanlarList;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View listViewItem = inflater.inflate(R.layout.activity_post_adapter,null,true);
TextView textViewcins = listViewItem.findViewById(R.id.textViewcins);
TextView textViewcinsiyet2 = listViewItem.findViewById(R.id.textViewcinsiyet2);
TextView textViewsehir = listViewItem.findViewById(R.id.textViewsehir);
TextView textViewtur2 = listViewItem.findViewById(R.id.textViewtur2);
TextView textViewyas = listViewItem.findViewById(R.id.textViewyas);
TextView textViewtel= listViewItem.findViewById(R.id.textviewtel);
Posts ilan= ilanlarList.get(position);
textViewcins.setText(ilan.AnimalBreed);
textViewcinsiyet2.setText(ilan.AnimalGender);
textViewsehir.setText(ilan.AnimalLocation);
textViewtur2.setText(ilan.AnimalName);
textViewyas.setText(ilan.AnimalAge);
textViewtel.setText(ilan.AnimalNumber);
return listViewItem;
}
}