Back to project page big_nerd_ranch_book_progress.
The source code is released under:
GNU Lesser General Public License
If you think the Android project big_nerd_ranch_book_progress 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 com.bignerdranch.android.geoquiz; //from w w w . java2 s . c o m import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class CheatActivity extends Activity { public static final String EXTRA_ANSWER_IS_TRUE = "com.bignerdranch.android.geoquiz.answer_is_true"; public static final String EXTRA_ANSWER_SHOWN = "com.bignerdranch.android.geoquiz.answer_shown"; private boolean mAnswerIsTrue; private TextView mAnswerTextView; private TextView mBuildVersionTextView; private Button mShowAnswer; private void setAnswerShownResult(boolean isAnswerShown) { Intent data = new Intent(); data.putExtra(EXTRA_ANSWER_SHOWN, isAnswerShown); setResult(RESULT_OK, data); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cheat); mAnswerIsTrue = getIntent().getBooleanExtra(EXTRA_ANSWER_IS_TRUE, false); mAnswerTextView = (TextView)findViewById(R.id.answerTextView); // Answer will not be shown until the user presses the button setAnswerShownResult(false); mBuildVersionTextView = (TextView)findViewById(R.id.buildTextView); mBuildVersionTextView.setText("API Level: " + String.valueOf(Build.VERSION.SDK_INT)); mShowAnswer = (Button)findViewById(R.id.showAnswerButton); mShowAnswer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (mAnswerIsTrue) { mAnswerTextView.setText(R.string.true_button); } else { mAnswerTextView.setText(R.string.false_button); } setAnswerShownResult(true); } }); } }