OK I\'m new to android dev\'s and Java, so I\'m having problems with on click method here\'s my code. I know I\'ve gotta be close, thanks in advance. All I want my button to
You need to make the same method name both in layout XML and java code.
If you use android:onClick="setLogin"
then you need to make a method with the same name, setLogin:
// Please be noted that you need to add the "View v" parameter
public void setLogin(View v) {
}
ADVICE:
Do not mix layout with code by using android:onClick
tag in your XML. Instead, move the click method to your class with OnClickListener
method like:
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
Make a layout just for layout and no more. It will save your precious time when you need to refactoring for Supporting Multiple Screens.