A.J
A.J

Reputation: 726

Android switch text button?

I am developping an app that has some quotes but I am unable to have next/previous buttons to navigate between the quotes like in the attached image ?? can anybody help ?

http://img.technospot.net/Free-Android-app-Success-Quotes.jpg

Upvotes: 0

Views: 285

Answers (2)

Ahmad
Ahmad

Reputation: 72533

I'm assuming you are genarating randoms numbers to show the quotes randomly. Just save the position of the quotes(are they stored in an array?) and save them in an Integers List every time the user clicks next.

 List<Integer> intList = new ArrayList<Integer>();

So if the user wants to go back just get the previous number which was shown by accessing the list with :

intList.get(intList.size()-1);

You should provide more informations next time and be as precise as you can.

Upvotes: 1

Michael
Michael

Reputation: 3332

If the only that that's changing is the quote, just have the next and previous buttons change the text on click to the next quote in the cycle.

Upvotes: 1

Related Questions