Reputation: 13
I want to make a quiz app. So i want to change the question statement in fragment
. How can i do that
Upvotes: 1
Views: 221
Reputation: 160
First you have to create QuestionType list with question, option1, option2, option3, option3,
correct option.
and on onclick
button get question from list and change values for your radio group
.
Hope this will help you.
Upvotes: 2
Reputation: 135
Activity can call fragment method by acquiring a reference to the Fragment.
Call fragment like this-
transaction.add(R.id.fragment_container, myFragment, "myfragmentTag");
and by the help of fragment object you can call fragment method
myFragment.refreshQuestion();
You can also use the Interface to achieve this
Upvotes: 0
Reputation: 1
Store your question in ArrayList or some permanent storage like DB and then traverse list until last item is reached.Fetch value and set to textView by using setText() method.
Upvotes: 0
Reputation: 1463
Just make an ArrayList consisting Questions, answer and options
.
On clicking Next Question, you just need to change the index of the arraylist.
When its the last question just change the text of button to Submit
Upvotes: 0