In the following code segment when built I keep breaking when adding the OnClickListener to the button.
package xxx.xxx.xxx;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
public class TeaActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Button AddItem = (Button)findViewById(R.id.button1);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AddItem.setOnClickListener(AddButtonHandler);
}
View.OnClickListener AddButtonHandler = new View.OnClickListener() {
public void onClick(View v) {
// it was the first button
}
};
When debugging the code will break on the setOnClickListener() call. Not sure why
change it to this