I am trying to display random URLs in a Web View, each time I click a button in android. The URLs are stored in a database.
Are there any functions readily available for this like, onFirstClick, onSecondClick etc. ?
I am trying to display random URLs in a Web View, each time I click a button in android. The URLs are stored in a database.
Are there any functions readily available for this like, onFirstClick, onSecondClick etc. ?
Sett listeners for all the buttons that you want. Then in those onClick() run a method that follows the logic below.
1st) Get the number of rows in the database as an int numRows
I supposed
2nd) Generate a random number between 0 to numRows
. How do I generate random integers within a specific range in Java?
3rd) Query that row number.
You could use an int to keep track of the amount of clicks the user has performed. Also you could use if branching or switch cases if you want to differentiate between first and second clicks and so on.