当我在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