0

Change defaultViewId of application

Hi all,

Is there any way to change defaultViewId of application?

My problem is:
At the first time go to widget, it will show the screen 1,
and after 10seconds, it will load the screen 2.

And then, if you select the HOME button, it must show the screen 2.
But because i set defaultViewId: the screen 1, it always shows the screen 1.

I think i must set defaultViewId: the screen 2 after unload the screen 1.

Please help me if you know.
Thanks.

Jerry ^ _ ^

by
1 Reply
  • The right way to do this is to always set defaultViewId to be the id of view2. Then inside your snippet code, do the following:

    CODE
            initView: function() {
    this._handleActivateSnippet.subscribeTo(this, ['onActivateSnippet'], this);
    },

    _handleActivateSnippet: function(event) {
    if(view1_has_been_seen) {
    // let default happen, which is to go to view2
    return
    } else {
    event.preventDefault();
    event.stopPropagation();
    KONtx.application.setHostResultToViewId(event, "id of view1");
    }
    },


    The above code decides somehow if view1 has been seen, if so, just go to the default of view2, otherwise prevent the default and go where we say to (aka the id of view1).

    Then inside view1, I would probably switch views to view2 like this:

    KONtx.application.loadDefaultView();

    The benefit of that line above is that the user won't have view1 in their history and the history will be fresh as of the load to view2.

    -Jeremy
    0

Recent Posts

in General - Yahoo! TV Widgets