class checkPlay extends MainScreen {
FieldChangeListener listener;
public checkPlay() {
setTitle("Testing");
listener = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
ButtonField playButton= (ButtonField) field;
signUp sinup=new signUp();
sinup.newMethod();
}
};
ButtonField playButton = new ButtonField("Test Button");
playButton.setChangeListener(listener);
add(playButton);
}
// TODO Auto-generated constructor stub
}
class signUp extends MainScreen {
public signUp(){
// setTitle("Sign Up For New Account");
BasicEditField firstName = new BasicEditField("First Name*: ", "");
BasicEditField lastName = new BasicEditField("Last Name*: ", "");
EmailAddressEditField Email = new EmailAddressEditField("Email*: ", "");
ButtonField joinButton = new ButtonField("JOIN NOW",ButtonField.FIELD_LEFT);
add(firstName);
add(lastName);
add(Email);
add(joinButton);
}
void newMethod() {
setTitle("Dhoni");
}
}
我想newMethod
通过单击 ButtonField 来调用方法。checkPlay
我在课堂上放了一个 ButtonField 。单击该 ButtonField 应调用newMethod
. 但是这段代码不起作用。
需要帮忙。