user1537814
user1537814

Reputation: 85

Moving from 1 view to another

I have an application in which I ask a General Knowledge question. Each question is a TextView and solutions are shown as choices (4 buttons).

Though I am still designing, I was wondering if there is a way to move from 1 TextView (the question) to the next. Though, it is possible to transit from 1 activity to another (each activity becomes a question and an answer), but I am sure there might be a better way to do that.

Upvotes: 0

Views: 107

Answers (4)

barisemreefe
barisemreefe

Reputation: 434

Instead of creating a new activity for each, why not use Fragments?

Upvotes: 0

caknia
caknia

Reputation: 1251

I think you have great idea about that but I think you waste your design if you do that.

I have another idea, how about you create each question as an array then you can call the other on the same activity. I think it's more compact at design. :)

for example:

       TextView textview = (TextView) findViewById(R.id.yourid);
       textview .setText(Questions here!!)

Upvotes: 0

vinothp
vinothp

Reputation: 10069

Hi You don't need to Use Activity for each Question. Instead of that you can change the text in TextView.

Use this in Button OnClick

           TextView textview = (TextView) findViewById(R.id.yourid);
           textview .setText(yourQuestion)

I hope It helps.

Upvotes: 2

Niko
Niko

Reputation: 8153

You could place your questions inside a ScrollView and when user clicks answer for question you get the y position of next question and use ScrollView scrollTo(0,y).

Upvotes: 0

Related Questions