Basically I'm trying to create an app where it generates random questions and displays them in a dialog box. I've managed to create a dialog box ok but incorporating the sql database full of questions and answers is proving difficult. I've been trying to follow this tutorial and it's the querying and actual gathering of information that I'm stuck on.
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

So the overall picture is a randomly generated question from a SQL database to appear in a dialog and once the user has clicked on an option, it displays whether the answer is correct in a Toast widget according to what the answer is, which is also in the SQL database.

Anyone know how I would obtain information from the database/generate a random field from the database?

Any ideas, references to resources, or help will be much appreciated!

Thanks.

Recommended Answers

All 2 Replies

  • grab all questions IDs,
  • put IDs in the list
  • generate random from 1 to size of the list
  • get ID from list at position that has value of randomly generated number

You have random question in the simplest way

That's the only bit of the task I understand. What I want to find out is how I incorporate the database into Eclipse. Thanks for posting though :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.