간단한 카운터를 만들고 싶습니다. 화면을 클릭하면 textvalue의 값이 증가합니다.화면을 클릭하면 TextView 값이 변경됩니다.
그래서 내 활동.
public class MyTasbih extends Activity implements View.OnClickListener {
//Button btn;
TextView t;
int i=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//btn=(Button)findViewById(R.id.button);
t=(TextView)findViewById(R.id.t);
//btn.setOnClickListener(this);
t.setOnClickListener(this);
updateCounter();
}
public void onClick(View view) {
i++;
updateCounter();
}
private void updateCounter() {
t.setText(i);
}
}
크래시. 나는 초보자입니다. 제발 도와주세요.
확인합니다. 어디에서 충돌했는지 알 수 있습니다. – Ran