LL.bindClass(“android.widget.Button”);

LL.bindClass(“android.widget.Button”);

LL.bindClass(“android.view.View”);

var mctx = LL.getContext();

var mButton = new Button(mctx);

mButton.setOnClickListener(new View.OnClickListener(){

onClick:function(View mButton){

Android.makeNewToast(“Hello World”, false).show();

}

});

return mButton;

Error: At Line 10 ) missing after formal parameters (onClickButton#10)

Im playing with custom views and failing 🙁 can any one tell me what I did wrong I think its my OnClick function but I don’t really know how to translate java to js and the android dev docs are kinda hard to read for me so theres probably something else wrong lol cheers.

]]>
« (Previous Post)

12 Commentsto LL.bindClass(“android.widget.Button”);

  1. Anonymous says:

    < ![CDATA[

    Did you bind android.view.View?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Yeah i did my bad i forgot about that i wrote this from memory its not a straight copy and paste, when I get back to my tab in about half hour I’ll copy and paste/replace this^ with my actual code and error message



    That reminds me it would be cool if we could select and copy text from the error dialog Pierre Hébert​

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Edited^ I tried fixing it by doing what the error said but still don’t work.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Replace the line


    onClick:function(View mButton){


    with


    onClick:function(view){

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Works 🙂 thanks the android docs are difficult to understand it says that the OnClick parameter is the view that was clicked I thought that would of been my button.

    ]]>

  6. Anonymous says:

    < ![CDATA[

    This can be your button (in this code this will only be your button) but you could reuse the same listener for several button, for instance this way:


    var btn1 = new Button(context);


    var btn2 = new Button(context);


    var btn3 = new Button(context);


    var listener = new View.OnClickListener(){


      onClick:function(view){


        if(view == btn1) {


           // do something for btn1


        } else if(view == btn2) {


           // do something for btn2


        } else if(view == btn2) {


           // do something for btn2


        }


      }


    };


    btn1.setOnClickListener(listener);


    btn2.setOnClickListener(listener);


    btn3.setOnClickListener(listener);



    This is slightly more efficient and can be used to factor code.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    I wouldn’t say the docs are difficult to understand but you need to catch the mindset. When I started to write android apps, I was really disoriented because it was different of what I was used to, but like everything else with a bit of practice it becomes easier 🙂

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Thanks for the explanation think I can also figure out how to use a switch and case from that, what about the error dialog text selection is that possible to implement? We could just screenshot it but you can’t attach pics to comments on g+ so this would be a handy feature to have.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    This is a smart idea, but at the moment I cannot afford this extra effort.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    No probs 🙂

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Pierre Hébert OT: How did you get the idea to write a launcher? Because your other apps seem to be of a completely different genre.


    OT 2: Why are the old plugins (e. g. Locker) still visible in Play Store? Aren’t they integrated anyway?

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Because I needed a launcher… The app had different goals at that time.


    The plugin is still here because it does no harm (it is still usable and the lock screen is not available in older free versions)

    ]]>

Leave a Reply

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