Android : eclipse changing text on button click

on Tuesday, September 2, 2014


I'm experiencing some probles with my andorid app I'm currently developing in eclipse bundle. I want to make a simple text change on a button click but unfortunately, when I run the app on my device it stops working. The app crashes on my device, but has no errors in eclipse.


This is my code:



final TextView chores = (TextView) findViewById(R.id.chores);
Button choreButton = (Button) findViewById(R.id.choreButton);

View.OnClickListener listener = new View.OnClickListener() {

@Override
public void onClick(View v) {

String next = "Go make some Coffee.";
chores.setText(next);

}
};
choreButton.setOnClickListener(listener);


Thanks for your help! :)


0 comments:

Post a Comment