Android Open Source - BNR-Quiz Quiz Results

From Project

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.

Java Source Code

package net.plastboks.bnr_quiz;
/*w  w w .  ja  va  2s . c  o m*/
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);

    protected void onCreate(Bundle savedInstanceState) {

        this.score = getIntent().getIntExtra(EXTRA_SCORE, 0);
        this.quizLength = getIntent().getIntExtra(EXTRA_QUIZ_LENGTH, 0);
        this.scoreTextView = (TextView)findViewById(;


        this.newQuizButton = (Button)findViewById(;
        this.newQuizButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(, menu);
        return true;

    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 == {
            return true;
        return super.onOptionsItemSelected(item);

Java Source Code List