getLocationOnScreen crashes, pls help
<p>I need to get the coordinates of my app on screen to use them as an offset for a popout.</p>

<pre><code>                    View tempView = (View) findViewById(R.layout.main);
                    int[] loc = {0,0};
                    tempView.getLocationOnScreen(loc); /// crashes here!
</code></pre>

<p>Tried this code, but the last line of it makes the app crash. Maybe the tempView I'm getting from the main layout somehow doesn't correspond with the layout on screen?</p>

<p>Any suggestions... thanks! :)</p>

<hr>

<p>added:
solved</p>

<pre><code>                    int[] loc = new int[2]; 
                    View tempView = (View) findViewById(R.id.LL_whole);
                    tempView.getLocationOnScreen(loc);

                    post( String.valueOf(loc[1]) );
</code></pre>

<p>works! :)</p>
