stumped adding a listener to textview and adding a previous button to geoquiz challenge – www.savvyessaywriters.net

stumped adding a listener to textview and adding a previous button to geoquiz challenge – www.savvyessaywriters.net

 

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…


Savvy Essay Writers

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational