954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Incorporating a SQL Database into your Android Application

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.

BlackStar0703
Newbie Poster
18 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 
  • 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

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

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 :)

BlackStar0703
Newbie Poster
18 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: