Created
January 29, 2017 17:57
-
-
Save safaorhan/5b772339d8482c09b269557eabecc839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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... | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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