This Android Quiz app is my attempt at the Project given in the Android Basics: User Interface course. Because I didn't pay to access the Nanodegree offered by Udacity, I don't get my work graded, but it's ok, I can blog about it anyway! Blogpost explaining my approach along with some screenshots can be found here: https://novembergave.wordpress.com/2016/12/22/my-first-app-android-christmas-app/
Last active
August 19, 2018 14:13
-
-
Save novembergave/df87c955886e5378718e0cbaf24eaba6 to your computer and use it in GitHub Desktop.
Christmas Quiz App (Udacity Android Beginners Project)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fillViewport="true"> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/activity_main" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
tools:context="com.example.android.christmasquiz.MainActivity"> | |
<TextView | |
style="@style/Headings" | |
android:text="@string/picture_quiz" /> | |
<ImageView | |
style="@style/RedBg" | |
android:padding="4dp" | |
android:src="@drawable/antanddec" /> | |
<LinearLayout | |
style="@style/RedBg" | |
android:layout_marginBottom="16dp" | |
android:orientation="horizontal" | |
android:paddingBottom="8dp"> | |
<RadioGroup | |
android:id="@+id/radio_one" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/one_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedOne" | |
android:text="@string/answer_one" /> | |
<RadioButton | |
android:id="@+id/one_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedOne" | |
android:text="@string/answer_one_two" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_one" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/answer_one" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<ImageView | |
style="@style/GreenBg" | |
android:padding="4dp" | |
android:src="@drawable/danielcraig" /> | |
<LinearLayout | |
style="@style/GreenBg" | |
android:layout_marginBottom="16dp" | |
android:orientation="horizontal" | |
android:paddingBottom="8dp"> | |
<RadioGroup | |
android:id="@+id/radio_two" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/two_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedTwo" | |
android:text="@string/answer_two_two" /> | |
<RadioButton | |
android:id="@+id/two_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedTwo" | |
android:text="@string/answer_two" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_two" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/answer_two" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<ImageView | |
style="@style/RedBg" | |
android:padding="4dp" | |
android:src="@drawable/princeharry" /> | |
<LinearLayout | |
style="@style/RedBg" | |
android:layout_marginBottom="16dp" | |
android:orientation="horizontal" | |
android:paddingBottom="8dp" | |
android:paddingTop="4dp"> | |
<RadioGroup | |
android:id="@+id/radio_three" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/three_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedThree" | |
android:text="@string/answer_three_two" /> | |
<RadioButton | |
android:id="@+id/three_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedThree" | |
android:text="@string/answer_three" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_three" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/answer_three" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<ImageView | |
style="@style/GreenBg" | |
android:padding="4dp" | |
android:src="@drawable/danielradcliffe" /> | |
<LinearLayout | |
style="@style/GreenBg" | |
android:layout_marginBottom="16dp" | |
android:orientation="horizontal" | |
android:paddingBottom="8dp" | |
android:paddingTop="8dp"> | |
<RadioGroup | |
android:id="@+id/radio_four" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/four_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedFour" | |
android:text="@string/answer_four" /> | |
<RadioButton | |
android:id="@+id/four_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedFour" | |
android:text="@string/answer_four_two" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_four" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/answer_four" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<TextView | |
style="@style/Headings" | |
android:text="@string/trivia" /> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/question_five" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<RadioGroup | |
android:id="@+id/radio_five" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/five_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedFive" | |
android:text="@string/five_one" /> | |
<RadioButton | |
android:id="@+id/five_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedFive" | |
android:text="@string/five_two" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_five" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/five_two" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/question_six" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<RadioGroup | |
android:id="@+id/radio_six" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/six_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedSix" | |
android:text="@string/six_two" /> | |
<RadioButton | |
android:id="@+id/six_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedSix" | |
android:text="@string/six_one" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_six" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:paddingTop="0dp" | |
android:text="@string/six_one" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/question_seven" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<RadioGroup | |
android:id="@+id/radio_seven" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/seven_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedSeven" | |
android:text="@string/seven_one" /> | |
<RadioButton | |
android:id="@+id/seven_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedSeven" | |
android:text="@string/seven_two" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_seven" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/seven_two" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/question_eight" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<RadioGroup | |
android:id="@+id/radio_eight" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="horizontal"> | |
<RadioButton | |
android:id="@+id/eight_one" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedEight" | |
android:text="@string/eight_two" /> | |
<RadioButton | |
android:id="@+id/eight_two" | |
style="@style/Radio" | |
android:onClick="onRadioButtonClickedEight" | |
android:text="@string/eight_one" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/answer_eight" | |
style="@style/Answers" | |
android:layout_weight="1" | |
android:text="@string/eight_one" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/question_nine" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="2" | |
android:orientation="vertical"> | |
<CheckBox | |
android:id="@+id/nine_one" | |
style="@style/Options" | |
android:text="@string/nine_one" /> | |
<CheckBox | |
android:id="@+id/nine_two" | |
style="@style/Options" | |
android:text="@string/nine_two" /> | |
<CheckBox | |
android:id="@+id/nine_three" | |
style="@style/Options" | |
android:text="@string/nine_three" /> | |
<CheckBox | |
android:id="@+id/nine_four" | |
style="@style/Options" | |
android:text="@string/nine_four" /> | |
<CheckBox | |
android:id="@+id/nine_five" | |
style="@style/Options" | |
android:text="@string/nine_five" /> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<TextView | |
android:id="@+id/answer_nine" | |
style="@style/Answers" | |
android:text="@string/nine_answer" | |
android:visibility="invisible" /> | |
</LinearLayout> | |
</LinearLayout> | |
<TextView | |
style="@style/Headings" | |
android:text="@string/bonus" /> | |
<TextView | |
style="@style/Trivia" | |
android:text="@string/bonus_question" /> | |
<EditText | |
android:id="@+id/bonus_question" | |
style="@style/EditText" | |
android:hint="@string/bonus_hint" /> | |
<TextView | |
android:id="@+id/bonus_answer" | |
style="@style/Answers" | |
android:paddingBottom="16dp" | |
android:paddingLeft="8dp" | |
android:text="@string/bonus_answer" | |
android:visibility="invisible" /> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal"> | |
<Button | |
android:id="@+id/submit" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:onClick="submitButton" | |
android:text="Submit" /> | |
<Button | |
android:id="@+id/restart" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:onClick="restartButton" | |
android:text="Restart" /> | |
<Button | |
android:id="@+id/view_answers" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:onClick="viewAnswers" | |
android:text="View Answers" | |
android:visibility="gone" /> | |
</LinearLayout> | |
</LinearLayout> | |
</ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.christmasquiz; | |
import android.support.v4.content.res.ConfigurationHelper; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.CheckBox; | |
import android.widget.EditText; | |
import android.widget.RadioButton; | |
import android.widget.RadioGroup; | |
import android.widget.TextView; | |
import android.widget.Toast; | |
import org.w3c.dom.Text; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
int score = 0; | |
//Submit Button to calculate scores | |
public void submitButton(View view) { | |
checkAnswersBonusQ(); | |
checkQuestionNine(); | |
Toast.makeText(this, ("Your score is " + score), Toast.LENGTH_SHORT).show(); | |
//unhide the view answers button | |
Button viewAnswers = (Button) findViewById(R.id.view_answers); | |
viewAnswers.setVisibility(View.VISIBLE); | |
//disable submit button to prevent resubmissions | |
Button submitButton = (Button) findViewById(R.id.submit); | |
submitButton.setEnabled(false); | |
} | |
//Restart button to reset quiz | |
public void restartButton(View view) { | |
//Reset Score | |
score = 0; | |
//Make answers invisible and make submit visible | |
Button viewAnswers = (Button) findViewById(R.id.view_answers); | |
viewAnswers.setVisibility(View.INVISIBLE); | |
Button submitButton = (Button) findViewById(R.id.submit); | |
submitButton.setVisibility(View.VISIBLE); | |
//enable submit and answers button | |
submitButton.setEnabled(true); | |
viewAnswers.setEnabled(true); | |
//Clear or hide answers | |
clearEditText(); | |
clearRadioButtons(); | |
clearCheckedBoxes(); | |
hideAnswers(); | |
Toast.makeText(this, "Quiz Reset", Toast.LENGTH_SHORT).show(); | |
} | |
//To show answers | |
public void viewAnswers(View view) { | |
//Show answer text boxes | |
TextView qOneAns = (TextView) findViewById(R.id.answer_one); | |
qOneAns.setVisibility(View.VISIBLE); | |
TextView qTwoAns = (TextView) findViewById(R.id.answer_two); | |
qTwoAns.setVisibility(View.VISIBLE); | |
TextView qThreeAns = (TextView) findViewById(R.id.answer_three); | |
qThreeAns.setVisibility(View.VISIBLE); | |
TextView bonusQAns = (TextView) findViewById(R.id.bonus_answer); | |
bonusQAns.setVisibility(View.VISIBLE); | |
TextView qFourAns = (TextView) findViewById(R.id.answer_four); | |
qFourAns.setVisibility(View.VISIBLE); | |
TextView qFiveAns = (TextView) findViewById(R.id.answer_five); | |
qFiveAns.setVisibility(View.VISIBLE); | |
TextView qSixAns = (TextView) findViewById(R.id.answer_six); | |
qSixAns.setVisibility(View.VISIBLE); | |
TextView qSevenAns = (TextView) findViewById(R.id.answer_seven); | |
qSevenAns.setVisibility(View.VISIBLE); | |
TextView qEightAns = (TextView) findViewById(R.id.answer_eight); | |
qEightAns.setVisibility(View.VISIBLE); | |
TextView qNineAns = (TextView) findViewById(R.id.answer_nine); | |
qNineAns.setVisibility(View.VISIBLE); | |
//Hide Submit button | |
Button submitButton = (Button) findViewById(R.id.submit); | |
submitButton.setEnabled(false); | |
//Disable Answers button to prevent resubmissions | |
Button answerButton = (Button) findViewById(R.id.view_answers); | |
answerButton.setEnabled(false); | |
Toast.makeText(this, "Answers now shown\nRestart to continue", Toast.LENGTH_SHORT).show(); | |
} | |
//For Bonus Q: Obtain answer from input | |
public String bonusQ() { | |
EditText editText = (EditText) findViewById(R.id.bonus_question); | |
return editText.getText().toString(); | |
} | |
//For Bonus Q: Check if answer is correct | |
public int checkAnswersBonusQ() { | |
TextView answer = (TextView) findViewById(R.id.bonus_answer); | |
if (bonusQ().equalsIgnoreCase(answer.getText().toString())) { | |
score += 1; | |
} | |
return score; | |
} | |
//For Q 1, check for correct answers | |
public void onRadioButtonClickedOne(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.one_one: | |
if (checked) | |
score += 1; | |
break; | |
case R.id.one_two: | |
if (checked) | |
//nothing | |
break; | |
} | |
} | |
//For Q 2, check for correct answers | |
public void onRadioButtonClickedTwo(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.two_one: | |
if (checked) | |
//nothing | |
break; | |
case R.id.two_two: | |
if (checked) | |
score += 1; | |
break; | |
} | |
} | |
//For Q 3, check for correct answers | |
public void onRadioButtonClickedThree(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.three_one: | |
if (checked) | |
//nothing | |
break; | |
case R.id.three_two: | |
if (checked) | |
score += 1; | |
break; | |
} | |
} | |
//For Q 4, check for correct answers | |
public void onRadioButtonClickedFour(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.four_one: | |
if (checked) | |
score += 1; | |
break; | |
case R.id.four_two: | |
if (checked) | |
//nothing | |
break; | |
} | |
} | |
//For Q 5, check for correct answers | |
public void onRadioButtonClickedFive(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.five_one: | |
if (checked) | |
//nothing | |
break; | |
case R.id.five_two: | |
if (checked) | |
score += 1; | |
break; | |
} | |
} | |
//For Q 6, check for correct answers | |
public void onRadioButtonClickedSix(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.six_one: | |
if (checked) | |
score += 1; | |
break; | |
case R.id.six_two: | |
if (checked) | |
//nothing | |
break; | |
} | |
} | |
//For Q 7, check for correct answers | |
public void onRadioButtonClickedSeven(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.seven_one: | |
if (checked) | |
//nothing | |
break; | |
case R.id.seven_two: | |
if (checked) | |
score += 1; | |
break; | |
} | |
} | |
//For Q 8, check for correct answers | |
public void onRadioButtonClickedEight(View view) { | |
// Is the button now checked? | |
boolean checked = ((RadioButton) view).isChecked(); | |
// Check which radio button was clicked | |
switch (view.getId()) { | |
case R.id.eight_one: | |
if (checked) | |
//nothing | |
break; | |
case R.id.eight_two: | |
if (checked) | |
score += 1; | |
break; | |
} | |
} | |
//For Q 9, check for correct answers | |
public void checkQuestionNine() { | |
CheckBox dashing = (CheckBox) findViewById(R.id.nine_one); | |
CheckBox prancer = (CheckBox) findViewById(R.id.nine_two); | |
CheckBox hurricane = (CheckBox) findViewById(R.id.nine_three); | |
CheckBox comet = (CheckBox) findViewById(R.id.nine_four); | |
CheckBox spotty = (CheckBox) findViewById(R.id.nine_five); | |
if (dashing.isChecked() || hurricane.isChecked() || spotty.isChecked()) { | |
return; | |
} else if (prancer.isChecked() && comet.isChecked()) { | |
score += 2; | |
return; | |
} else if (prancer.isChecked() || comet.isChecked()) { | |
score += 1; | |
} | |
} | |
//Clear RadioGroup Actions | |
public void clearRadioButtons() { | |
RadioGroup qOne = (RadioGroup) findViewById(R.id.radio_one); | |
qOne.clearCheck(); | |
RadioGroup qTwo = (RadioGroup) findViewById(R.id.radio_two); | |
qTwo.clearCheck(); | |
RadioGroup qThree = (RadioGroup) findViewById(R.id.radio_three); | |
qThree.clearCheck(); | |
RadioGroup qFour = (RadioGroup) findViewById(R.id.radio_four); | |
qFour.clearCheck(); | |
RadioGroup qFive = (RadioGroup) findViewById(R.id.radio_five); | |
qFive.clearCheck(); | |
RadioGroup qSix = (RadioGroup) findViewById(R.id.radio_six); | |
qSix.clearCheck(); | |
RadioGroup qSeven = (RadioGroup) findViewById(R.id.radio_seven); | |
qSeven.clearCheck(); | |
RadioGroup qEight = (RadioGroup) findViewById(R.id.radio_eight); | |
qEight.clearCheck(); | |
} | |
//Clear EditText | |
public void clearEditText() { | |
EditText bonusQ = (EditText) findViewById(R.id.bonus_question); | |
bonusQ.setText(null); | |
} | |
//Clear Checked boxes | |
public void clearCheckedBoxes() { | |
CheckBox nineOne = (CheckBox) findViewById(R.id.nine_one); | |
nineOne.setChecked(false); | |
CheckBox nineTwo = (CheckBox) findViewById(R.id.nine_two); | |
nineTwo.setChecked(false); | |
CheckBox nineThree = (CheckBox) findViewById(R.id.nine_three); | |
nineThree.setChecked(false); | |
CheckBox nineFour = (CheckBox) findViewById(R.id.nine_four); | |
nineFour.setChecked(false); | |
CheckBox nineFive = (CheckBox) findViewById(R.id.nine_five); | |
nineFive.setChecked(false); | |
} | |
//Action to hide all the answers made visible | |
public void hideAnswers() { | |
TextView bonusQAns = (TextView) findViewById(R.id.bonus_answer); | |
bonusQAns.setVisibility(View.INVISIBLE); | |
TextView qOneAns = (TextView) findViewById(R.id.answer_one); | |
qOneAns.setVisibility(View.INVISIBLE); | |
TextView qTwoAns = (TextView) findViewById(R.id.answer_two); | |
qTwoAns.setVisibility(View.INVISIBLE); | |
TextView qThreeAns = (TextView) findViewById(R.id.answer_three); | |
qThreeAns.setVisibility(View.INVISIBLE); | |
TextView qFourAns = (TextView) findViewById(R.id.answer_four); | |
qFourAns.setVisibility(View.INVISIBLE); | |
TextView qFiveAns = (TextView) findViewById(R.id.answer_five); | |
qFiveAns.setVisibility(View.INVISIBLE); | |
TextView qSixAns = (TextView) findViewById(R.id.answer_six); | |
qSixAns.setVisibility(View.INVISIBLE); | |
TextView qSevenAns = (TextView) findViewById(R.id.answer_seven); | |
qSevenAns.setVisibility(View.INVISIBLE); | |
TextView qEightAns = (TextView) findViewById(R.id.answer_eight); | |
qEightAns.setVisibility(View.INVISIBLE); | |
TextView qNineAns = (TextView) findViewById(R.id.answer_nine); | |
qNineAns.setVisibility(View.INVISIBLE); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<string name="app_name">Christmas Quiz</string> | |
<string name="picture_quiz">Guess the Celebrity Santa</string> | |
<string name="prompt_firstlast">First name last name</string> | |
<string name="prompt_group">Name of duo</string> | |
<string name="prompt_title">Title name</string> | |
<string name="answer_one">Ant and Dec</string> | |
<string name="answer_one_two">Jedward</string> | |
<string name="answer_two">Daniel Craig</string> | |
<string name="answer_two_two">Ian Fleming</string> | |
<string name="answer_three">Prince Harry</string> | |
<string name="answer_three_two">Prince William</string> | |
<string name="answer_four">Daniel Radcliffe</string> | |
<string name="answer_four_two">Ron Weasley</string> | |
<string name="trivia">Trivia</string> | |
<string name="question_five">London\'s Trafalgar Square Christmas tree is traditionally given | |
by which country?</string> | |
<string name="five_one">Sweden</string> | |
<string name="five_two">Norway</string> | |
<string name="question_six">What Christmas item was invented by London baker and | |
wedding-cake specialist Tom Smith in 1847?</string> | |
<string name="six_one">Christmas Pudding</string> | |
<string name="six_two">Christmas Cracker</string> | |
<string name="question_seven">With turkey being practically unknown in which Asian country | |
has KFC become the Christmas treat?</string> | |
<string name="seven_one">Korea</string> | |
<string name="seven_two">Japan</string> | |
<string name="question_eight">What was the name of the penguin in the 2014 John | |
Lewis Christmas Advert?</string> | |
<string name="eight_one">Monty</string> | |
<string name="eight_two">Boxer</string> | |
<string name="question_nine">Which of the following is the name of Santa\'s reindeer?</string> | |
<string name="nine_one">Dashing</string> | |
<string name="nine_two">Prancer</string> | |
<string name="nine_three">Hurricane</string> | |
<string name="nine_four">Comet</string> | |
<string name="nine_five">Spotty</string> | |
<string name="nine_answer">Prancer and Comet</string> | |
<string name="bonus">Anagram</string> | |
<string name="bonus_hint">Name of the most popular Christmas toy in 2001</string> | |
<string name="bonus_question">Hot Bubble Ride</string> | |
<string name="bonus_answer">Bob the Builder</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">#4CAF50</item> | |
<item name="colorPrimaryDark">#1B5E20</item> | |
<item name="colorAccent">#EF5350</item> | |
</style> | |
<style name="Headings"> | |
<item name="android:paddingTop">16dp</item> | |
<item name="android:paddingBottom">16dp</item> | |
<item name="android:paddingLeft">8dp</item> | |
<item name="android:textSize">20sp</item> | |
<item name="android:textAllCaps">true</item> | |
<item name="android:layout_width">wrap_content</item> | |
<item name="android:layout_height">wrap_content</item> | |
</style> | |
<style name="Answers"> | |
<item name="android:textSize">14sp</item> | |
<item name="android:paddingTop">8dp</item> | |
<item name="android:layout_width">wrap_content</item> | |
<item name="android:layout_height">wrap_content</item> | |
</style> | |
<style name="Trivia"> | |
<item name="android:padding">8dp</item> | |
<item name="android:textSize">16sp</item> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:layout_height">wrap_content</item> | |
</style> | |
<style name="Radio"> | |
<item name="android:paddingRight">16dp</item> | |
<item name="android:textSize">14sp</item> | |
<item name="android:layout_width">wrap_content</item> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:layout_weight">1</item> | |
</style> | |
<style name="Options"> | |
<item name="android:paddingTop">8dp</item> | |
<item name="android:paddingBottom">8dp</item> | |
<item name="android:textSize">14sp</item> | |
<item name="android:layout_width">wrap_content</item> | |
<item name="android:layout_height">wrap_content</item> | |
</style> | |
<style name="EditText"> | |
<item name="android:paddingTop">8dp</item> | |
<item name="android:paddingBottom">8dp</item> | |
<item name="android:paddingLeft">8dp</item> | |
<item name="android:textSize">14sp</item> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:inputType">textCapWords</item> | |
</style> | |
<style name="RedBg"> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:background">#FF8A80</item> | |
<item name="android:scaleType">centerCrop</item> | |
<item name="android:cropToPadding">true</item> | |
</style> | |
<style name="GreenBg"> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:background">#B9F6CA</item> | |
<item name="android:scaleType">centerCrop</item> | |
<item name="android:cropToPadding">true</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This Android Quiz app is my attempt at the Project given in the Android Basics: User Interface course.
Because I didn't pay to access the Nanodegree offered by Udacity, I don't get my work graded, but it's ok, I can blog about it anyway!
Blogpost explaining my approach along with some screenshots can be found here.
I look forward to any comments and suggestions!