stumped adding a listener to textview and adding a previous button to geoquiz challenge

Get quality term paper help at Unemployedprofessor.net. Use our paper writing services to score better and meet your deadlines. It is simple and straightforward. Whatever paper you need—we will help you write it!


Order a Similar Paper Order a Different Paper

This is only for android proficient tutors.

This is from the 2nd Edition Android Programming Big Nerd Ranch Guide – Chapter 2.

This was for my Listener, added to the Quiz activity:

mQuestionTextView = (TextView)findViewById(R.id.question_text_view); mQuestionTextView.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View V){ mCurrentIndex = (mCurrentIndex+1)%mQuestionBank.length; updateQueston(); }

I added this to the XML:

<TextView android_id="@+id/question_text_view" android_layout_width="wrap_content" android_layout_height="wrap_content" android_padding="24dp" android_clickable="true"/>

This still isn't functioning as a proper listener :|

In addition, I need to add a ‘previous button’ to pull users back to the previous question, but for some reason my code isn’t working. I could use some help in getting this to work.

In my strings xml file, I added this:

<string name=”prev_question_button”>Previous</string>

Changed the new layout xml to this:

<Button android_id=”@+id/previous_button” android_layout_width=”wrap_content” android_layout_height=”wrap_content” android_text=”@string/prev_question_button” android_drawableLeft=”@drawable/arrow_left” android_drawablePadding=”4dp”/> <Button android_id=”@+id/next_button” android_layout_width=”wrap_content” android_layout_height=”wrap_content” android_text=”@string/next_question_button” android_drawableRight=”@drawable/arrow_right” android_drawablePadding=”4dp”/>

My activity looks like this:

mPrevButton = (Button)findViewById(R.id.prev_button); mPrevButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { if (mCurrentIndex == 0) { mCurrentIndex = mQuestionBank.length – 1; } else { mCurrentIndex = mCurrentIndex – 1; } updateQueston(); } });

I’m getting errors when I build the project… some help would be much appreciated to get this up and running!

Be sure you have maven and updated to the gradle version 3.0.1

Attached is a zip of my progress…


Writerbay.net

Our affordable academic writing services save you time, which is your most valuable asset. Share your time with your loved ones as our Unemployedprofessor.net experts deliver unique, and custom-written paper for you.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper