Pierre Hébert is there any possibility to pass an array as reference?

Pierre Hébert is there any possibility to pass an array as reference? I need to use  View.getLocationOnScreen, but it requires a reference which I’m not able to create…

( developer.android.com/reference/android/view/View.html#getLocationOnScreen(int[]) )

]]>
(Next Post) »

5 Commentsto Pierre Hébert is there any possibility to pass an array as reference?

  1. Anonymous says:

    < ![CDATA[

    I’m interested on this topic too.


    When I made my puzzle script I need to use a function with a reference array, and I didn’t know how to do that. Fortunately it was easy to make myself that function using another one without references.



    Is View.getLeft() View.getTop() possible to use in your script?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    I have found a completely other solution, but I’d still like to know how to do it.


    getTop() returns the relative position of a view to it’s parent. Unfortunately I can’t determine the position of the root view (the dialog) on the screen.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Everything is reference, but javascript arrays are not java arrays and the engine cannot map one into the other one.



    Try this:


    var a = java.lang.reflect.Array.newInstance(java.lang.Integer, 5);


    (where 5 is the array size)



    Set elements using the common array accessor, i.e. a[0] = 3;


    Then use this variable as argument to the function.



    getLeft and getTop might not work, especially when transformation are in use. The best I can say is to avoid using them. Lightning has a very special way to handle the geometry.



    Regarding the dialog, you also need to take into account the position of the window, because dialogs have their own window. But I am not sure of what you want to achieve, I think this is suspicious!

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Pierre Hébert I tried that, but it says can’t find function when I try to use the array with bitmap.getPixels

    ]]>

  5. Anonymous says:

    < ![CDATA[

    My bad. Replace java.lang.Integer with java.lang.Integer.TYPE

    ]]>

Leave a Reply

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