Hello. I would like to do quiz game. It contains about 50 topics. All questions I store in the database. After starting the application, the user selects the topic and answers the question with 4 answers. Display all the questions I can. But the problem is how to display exactly the questions of the topic that the user chose? I thought to create Database classes for each topic. But that is too much. I hope I was able to bring the problem to you.
1 answer
Create a database with _id columns (mandatory column), subject, question, answer. Fill it up. And further by forming the corresponding query to the database, for example, in the cursor, you prescribe the necessary selection conditions for filling the corresponding view. In your case the cursor should be filled programmatically. The user selects a topic and this selection is a parameter in the cursor. You can also build a database using several tables, then you have to enter some identifiers connecting questions with topics and transfer them to the cursor.
|
SELECT * FROM questions WHERE theme = 'тут нужная тема'- Vladyslav Matviienkoquestionsthere is a field theme_id. Separately table themes with themes. Each topic does not need a separate class or table. Choose questions with a sql query with the condition where theme_id =? D ... - jekaby