Android Question (Solved)Need a bit of guidence

brianwiz12

Active Member
Licensed User
Longtime User
Hello,

I have started working with databases so I can do question/answers/trivia/quiz's whatever you would like to call it.

I have been learning from SQLDBUtils SourceCode. I have learned how to do the following:

WebView
Listview
Edit/Add/delete

from my own database.

Yes this means I took the code apart and implemented my information and deleted a bunch of things.

Now I added a Trivia module with the following code so far

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim radiobutton1 As RadioButton
    Dim radiobutton2 As RadioButton
    Dim radiobutton3 As RadioButton
    Dim SQL1 As SQL

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("trivia")
  
radiobutton1.Text = "Hello"
radiobutton2.Text = SQL1.ExecQuerySingleResult("SELECT ChoiceOne FROM Quiz where ID = 2")
radiobutton3.Text = "Hello"

Now I'm trying to figure out why I get a Java error when I'm asking radiobutton2.text to look at ChoiceOne field from the Quiz table. ChoiceOne is one of three choices for the answer

Also if you can point me to a tutuorial that covers a question/answer type of situation I would appreciate it. I see a lot of useful ones.
 

brianwiz12

Active Member
Licensed User
Longtime User
The Error message is Object should first be initialized... Click Yes it shows the Label and the first Radio button text and that's it.

I have made sure to load the layout
Activity.LoadLayout("trivia")

Here is the type of program I'm looking to create step by step We will use Jericho TV Show App that I hard coded as base.

Jericho had 2 seasons. One with 23 episodes and one with 7 episodes
database Name: Jericho
Table Season One (then I would list all episodes/questions) 1.1,1.2,1.3,1.4 ect
Table Season Two (Then I would list all episodes/questions) 1.1,1.2,1.3,1.4 ect

-------------------------
For right now I have the following simple I'm trying to do

Question
ChoiceOne
ChoiceTwo
ChoiceThree

they get filled in and then person selects the answer. When complete it goes to next question.
 
Last edited:
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
You have not initialized the SQL object...
 
Upvote 0

brianwiz12

Active Member
Licensed User
Longtime User
Well that was easy to do. I thought it would have been already initialized due to it being setup on the main screen. Learned another lesson :)
 
Upvote 0
Top