I have added a new view using a listener on the enter event:
function onKey(evt) {
if (evt.getKey() == Ui.KEY_ENTER) {
Ui.pushView(new CView(), new CDelegate(), Ui.SLIDE_DOWN);
return true;
}
return false;
}
I then want to enable returning back to the main view:
class CDelegate extends Ui.BehaviorDelegate {
function onBack() {
switchBack();
System.println("BACK");
return true;
}
function onNextPage() {
System.println("NEXT PAGE");
switchBack();
return true;
}
function onPreviousPage() {
System.println("PREVIOUS PAGE");
switchBack();
return true;
}
function switchBack() {
Ui.popView(Ui.SWIPE_DOWN);
}}
This works fine on the simulator. However when testing on my watch when returning from the second view the watch displays the normal watch face for a few seconds and then goes back to the main page of my widget. However the functionality is strange. For example it doesn't really respond to more keys except after a long delay. It's as almost as if the event is being captured first by the watch and then by the widget and something goes wrong. A similar thing happens with up or down. It momentarily returns to the main page of the widget and then goes to the next real widget - again as if the watch has captured the event.
When I look at the CIQ_LOG.txt log I get the following message:
TVM ERROR:
Circular Dependency Error
Unfreed memory on exit
I know that something like this must be possible because the widgets such as the Weather or barometer widget use the "enter" key and return functionality.
What I am doing wrong?