-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathEventAdapter.java
More file actions
37 lines (29 loc) · 1.04 KB
/
EventAdapter.java
File metadata and controls
37 lines (29 loc) · 1.04 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
package codewithcal.au.calendarappexample;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
public class EventAdapter extends ArrayAdapter<Event>
{
public EventAdapter(@NonNull Context context, List<Event> events)
{
super(context, 0, events);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent)
{
Event event = getItem(position);
if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.event_cell, parent, false);
TextView eventCellTV = convertView.findViewById(R.id.eventCellTV);
String eventTitle = event.getName() +" "+ CalendarUtils.formattedTime(event.getTime());
eventCellTV.setText(eventTitle);
return convertView;
}
}