0
嗨,我似乎無法建立此..它聲明,它不能解決OnClickListener
。 onClick操作執行後退按鈕進入主要活動。Android Studio不能解決錯誤setOnClickListener
Button bnCompute = (Button) this.findViewById(R.id.bnCompute);
bnCompute.setOnClickListener(new View.OnClickListener());
{
@Override
public void onClick (View view){
Toast.makeText(MainActivity.this, "You Compute All!", Toast.LENGTH_LONG).show();
EditText etBeauty = (EditText) MainActivity.this.findViewById(R.id.etBeauty);
EditText etBody = (EditText) MainActivity.this.findViewById(R.id.etBody);
EditText etIntelligence = (EditText) MainActivity.this.findViewById(R.id.etIntelligence);
int total = Integer.parseInt(String.valueOf(etBeauty.getText())) + Integer.parseInt(String.valueOf(etBody.getText()))
+ Integer.parseInt(String.valueOf(etIntelligence.getText()));
Intent actSummary = new Intent(MainActivity.this, Score.class);
actSummary.putExtra("total", Integer.toString(total));
MainActivity.this.startActivity(actSummary);
}
}
非常感謝! :) –