1
votes

I would like to access my app's native hardware back button to go to a previous form. Sounds trivial, but I am running into a series of issues, when using the approaches found around here:

Command back = new Command("Back") {
     public void actionPerformed(ActionEvent ev) {

       showBack();
    }
};

or

Command back = new Command("Back") {
     public void actionPerformed(ActionEvent ev) {

       showPreviousForm();
    }
};

for both the approaches I get an error message :

The method showBack() is undefined for the type new Command(){}

or

The method PreviousForm() is undefined for the type new Command(){}

Has there been a change in methods? Is there are different approach?

Thanks in advance for any response.

1

1 Answers

1
votes

showBack is a method of Form so this would work if the command is defined within a Form subclass. Otherwise you would need an instance of the form to invoke this on.

showPreviousForm is a custom method you would need to define to show the previous form in some way.