问:我在LogCat中收到这些错误
main(本机方法)10-30 14:01:42.550 885-885 / com.teamtreehouse.funfacts I / Process:正在发送信号。PID:885 SIG:9
答:包 com.teamtreehouse.funfacts ;
导入android.app.Activity ; 导入android.os.Bundle ; 导入android.view.Menu ; 导入android.view.MenuItem ; 导入android.view.View ; 导入android.widget.Button ; 导入android.widget.RelativeLayout ; 导入android.widget.TextView ; 导入android.widget.Toast ; 公共类FunFactsActivity扩展了Activity { private FactRespond newFact
= 新的 FactRespond ();
私人的RelativeLayout newLayout = (RelativeLayout的)findViewById (ř 。ID 。FunFactsLayout ); private Colorof nextColor =新的Colorof (); @Override受保护的void onCreate (Bundle savedInstanceState ){超级。onCreate (savedInstanceState ); 的setContentView (ř 。布局
。activity_fun_facts );
最终的TextView FactLabel = (TextView的)findViewById (ř 。ID 。TextView的); 最终按钮showFactButton = (按钮)findViewById (ř 。ID 。按钮); 查看。OnClickListener listener = new View 。OnClickListener (){ @ Override public void onClick
(视图 视图) {
newLayout 。setBackgroundColor (nextColor 。的getColor ()); showFactButton 。setTextColor (nextColor 。的getColor ()); FactLabel 。的setText (newFact 。getFact ()); } }; showFactButton 。setOnClickListener (listener ); 吐司。makeText (这个,“好吧” ,Toast 。
LENGTH_LONG )。显示();
} } 这是funfacts活动的代码