Reputation: 85
When user click Next
button, it suppose to show next record store in database, but when I run the app, user have to click previous
button to view next entry and the Next
button didn't perform any activity.
public void onClick(View v) {
int buttonId = v.getId();
if (buttonId == R.id.buttonViewPrevious)
if (currentBoothArrayIndex < boothArrayList.size() - 1) {
displayBoothInformation(--currentBoothArrayIndex);
} else if (buttonId == R.id.buttonViewNext)
if (currentBoothArrayIndex < boothArrayList.size() - 1) {
displayBoothInformation(++currentBoothArrayIndex);
}
}
Upvotes: 1
Views: 44
Reputation: 12523
your if else
construct is wrong. Try this:
if (buttonId == R.id.buttonViewPrevious){
if (currentBoothArrayIndex < boothArrayList.size() - 1) {
displayBoothInformation(--currentBoothArrayIndex);
}
}else if (buttonId == R.id.buttonViewNext){
if (currentBoothArrayIndex < boothArrayList.size() - 1) {
displayBoothInformation(++currentBoothArrayIndex);
}
}
Upvotes: 3