-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdaptor.java
65 lines (51 loc) · 1.76 KB
/
Adaptor.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
63
64
65
package com.example.hp.myapplication;
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.text.TextPaint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
/**
* Created by Hp on 5.1.2018.
*/
public class Adaptor extends BaseAdapter {
private LayoutInflater mInflater;
private List<kullanici> mKisiListesi;
public Adaptor(Activity activity, List<kullanici> kisiler) {
//XML'i alıp View'a çevirecek inflater'ı örnekleyelim
mInflater = (LayoutInflater) activity.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
//gösterilecek listeyi de alalım
mKisiListesi = kisiler;
}
@Override
public int getCount() {
return mKisiListesi.size();
}
@Override
public kullanici getItem(int position) {
//şöyle de olabilir: public Object getItem(int position)
return mKisiListesi.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View satirView;
satirView = mInflater.inflate(R.layout.satir, null);
TextView text =
(TextView) satirView.findViewById(R.id.isimsoyisim);
text.setTypeface(text.getTypeface(), Typeface.BOLD);
text.setTextSize(18);
kullanici kisi = mKisiListesi.get(position);
text.setText(kisi.getIsim()+" "+kisi.getSoyisim());
return satirView;
}
}