I am new to Android development. This compiles in Eclipse without any errors, but when I run it in the emulator, it crashes, why?
package com.buttontest;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ButtonTest extends Activity {
int timesPressed = 0;
String timesPressedText = "";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button Button = (Button) findViewById(R.id.Button);
final TextView Textview = (TextView) findViewById(R.id.ButtonPressedText);
Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
timesPressed++;
timesPressedText = getString(timesPressed);
Textview.setText(timesPressedText);
}
});
}
}