Back to project page BNR-Quiz.
The source code is released under:
MIT License
If you think the Android project BNR-Quiz listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.plastboks.bnr_quiz; /*w w w . ja va 2s . c o m*/ import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; public class QuizResults extends Activity { private int score; private int quizLength; private TextView scoreTextView; private Button newQuizButton; public static final String EXTRA_SCORE = "net.plastboks.bnr_quiz.score_int"; public static final String EXTRA_QUIZ_LENGTH = "net.plastboks.bnr_quiz.quiz_length"; private void setScoreTextView() { String scoreText = String.format("%d out of %d correct answers", this.score, this.quizLength); this.scoreTextView.setText(scoreText); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz_results); this.score = getIntent().getIntExtra(EXTRA_SCORE, 0); this.quizLength = getIntent().getIntExtra(EXTRA_QUIZ_LENGTH, 0); this.scoreTextView = (TextView)findViewById(R.id.score_text_view); this.setScoreTextView(); this.newQuizButton = (Button)findViewById(R.id.new_button); this.newQuizButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.quiz_results, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }