@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fun_facts); mFactLabel = (TextView) findViewById(R.id.fact_text_view); mShowAnotherButton = (Button) findViewById(R.id.show_another_button); mRelativeLayout = (RelativeLayout) findViewById(R.id.relative_layout_container); mFactLabel.setText(mFactBook.getFact()); mShowAnotherButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // Update the Fact label with a new fact mFactLabel.setText(mFactBook.getFact()); // Update RelativeLayout background color with new color // Update Button background color with new color int color = mColorWheel.getNextColor(); mRelativeLayout.setBackgroundColor(getResources().getColor(color)); mShowAnotherButton.setTextColor(getResources().getColor(color)); } }); Log.d(TAG, "Logging from the FunFactsActivity!"); }
protected String getFact() { return mFactBook.getFact(); }