-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSetsAdapter.java
More file actions
63 lines (43 loc) · 1.42 KB
/
SetsAdapter.java
File metadata and controls
63 lines (43 loc) · 1.42 KB
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
package com.example.quizapp;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class SetsAdapter extends BaseAdapter {
private int numOfSets;
public SetsAdapter(int numOfSets) {
this.numOfSets = numOfSets;
}
public int getCount() {
return numOfSets;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(final int position, View convertView, final ViewGroup parent) {
View view;
if(convertView == null)
{
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.set_item_layout,parent,false);
}
else
{
view = convertView;
}
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(parent.getContext(), QuestionActivity.class);
intent.putExtra("SETNO", position+1);
parent.getContext().startActivity(intent);
}
});
((TextView) view.findViewById(R.id.setNo_tv)).setText(String.valueOf(position+1));
return view;
}
}