Skip to content

Instantly share code, notes, and snippets.

@safaorhan
Created January 29, 2017 17:57
Show Gist options
  • Save safaorhan/5b772339d8482c09b269557eabecc839 to your computer and use it in GitHub Desktop.
Save safaorhan/5b772339d8482c09b269557eabecc839 to your computer and use it in GitHub Desktop.
//Below the class
private int currentIndex = 0;
//On button Click
currentIndex++;
EventItem currentItem = EventAdapter.getItem(currentIndex);
drawItem(currentItem);
//drawItem
nameTextView.setText(currentItem.name);
loadImage(currentItem.imageUrl, imageView);
// list goes on...
public class EventAdapter {
private ArrayList<EventItem> eventList;
public EventAdapter(ArrayList<EventItem> eventList) {
this.eventList = eventList;
}
public EventItem getItem(int i) {
return eventList.get(i);
}
public void mark(boolean isYes, int i) {
getItem(i).isYes = isYes;
}
}
public class EventItem {
private String name;
private String imageUrl;
// Other fields
private boolean isYes;
//Getters and setters...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment