當我在eclipse中編寫我的代碼(以下)時,它在模擬器上給出了一個錯誤,您的應用程序意外停止。 sdk沒有安裝錯誤。這是我的代碼。Android應用程序意外停止
public class startingPoint extends Activity {
/** Called when the activity is first created. */
int counter1,counter2;
Button add;
Button sub;
TextView display;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
counter1=counter2 = 0;
add = (Button) findViewById(R.id.bAdd);
add = (Button) findViewById(R.id.bSub);
display = (TextView) findViewById(R.id.tvDisplay);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
counter1=counter1+1;
display.setText("Your total is "+counter1);
}
});
sub.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
counter2=counter2-1;
display.setText("Your total is "+counter2);
}
});
}
}
什麼是logcat的錯誤? – JoxTraex 2012-01-11 12:44:14