setPosition exception right after desktop onloading

setPosition exception right after desktop onloading

// script set to onLoad event of desktop.

//setTimeout(function() {

  var dt = LL.getCurrentDesktop();

  dt.setPosition(0, 0, 1, false); // go to home position with no animation, scale 100%.

//},5000);

Android.makeNewToast(‘Moved to home.’, true).show();

I know that on loading of desktop, its position moves to home automatically. So generally speaking we dont have to call it manually.

Anyway, apart from that, above script has no problem at all theoretically.

But if I make LL restart, then LL emits error popup saying

“Wrapped java.lang.NullPointerException” ( at setPositin line)

Of course, dt is not null at all.

So I delayed execution by setTimeout, but in no vain.

]]>

3 Commentsto setPosition exception right after desktop onloading

  1. Anonymous says:

    < ![CDATA[

    What if you use the LL.getEvent().getContainer() here instead?


    Maybe when the script runs there is still no current desktop (and getCurrentDesktop() returns null)

    ]]>

  2. Anonymous says:

    < ![CDATA[

    TrianguloY Same error happened.



    setTimeout(function() {


      var dt = LL.getEvent().getContainer(); //LL.getCurrentDesktop();


      if (dt) {


        dt.setPosition(0, 0, 1, false);


      }


    },5000);



    Maybe, problem of setPosition method…

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Yup, true, solved it like you did,


    in my “script-only-templat” here http://www.lightninglauncher.com/wiki/doku.php?id=templates

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *