title: cant get the absolute coordinates of a button in android
body: <p>I am trying to retrieve the absolute coordinates of a button. I have done the following coding but its always returning 0. can anyone help me out.</p>
  
  <pre><code>       Button b=(Button)findViewById(R.id.button1);
  
      int[] location = new int[2];
      b.getLocationOnScreen(location);
  
      for(int i=0;i&lt;location.length;i++)
      {
          Log.i("hhhhhhhh",""+location[i]);
      }
      Log.i("wid hei",""+width+","+height);
  </code></pre>