Android Question B4A Mysql question

apty

Active Member
Licensed User
Longtime User
I am connecting to an online mysql db using B4A job. My table has questions and i would like to move from one question to the next using previous/next buttons.

What i have done so far is to add the id of the questions to a list. I then use an index and set it to
B4X:
    CurrentIndex = questionslist.Size
my questionslist.size returns the correct number of questions from the table

How can i use it to get the exact question and post it on current page, then when i click next, it moves to the next question?
 

apty

Active Member
Licensed User
Longtime User
i am connecting as below:
B4X:
Sub selectquestions
 
    ExecuteSelectQuery("select question,id from questions",Q_SELECT)
  

End Sub
Sub ExecuteSelectQuery(Query As String, JobName As String)
    Dim job2 As HttpJob
  
    job2.Initialize("job2", Me)
  
    job2.PostString(url, Query)
  
End Sub

I then use the below code in JobDone

B4X:
questionslist.Add(m.Get("id"))

The questionslist contains ids of the questions.
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
Thanks. The problem i am having is how to move to next and previous pages showing next and previous questions. For example if my list has the following
B4X:
[{"question":"test question"},{"question":"test question2"},{"question":"test question3"}]
and i have a layout with a label and two buttons (previous and next buttons). How can i show the question on the label and move to next question on clicking next button?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…