title: Android: Need to use onSizeChanged for View.getWidth/Height() in class extending Activity
body: <p>I want to use getWidth()/getHeight() to get width/height of my XML-Layout.
  I read I have to do it in the method onSizeChanged() otherwise I will get 0
  ( <a href="https://stackoverflow.com/questions/2902640/android-get-the-screen-resolution-pixels-as-integer-values">Android: Get the screen resolution / pixels as integer values</a> ).</p>
  
  <p>But I want to do it in a class already extending Activity.
  So I think it's not possible let the same class extending View.</p>
  
  <pre><code>public class MyClass extends Activity {
  
      public void onCreate(Bundle savedInstanceState) {  
          super.onCreate(savedInstanceState);  
          setContentView(R.layout.main);  
          ViewGroup xml_layout = (ViewGroup) findViewById(R.id.layout_id);  
          TextView tv = new TextView(this);  
          tv = (TextView) findViewById(R.id.text_view);  
          int layout_height = xml_layout.getHeight();  
          int layout_width = xml_layout.getWidth();
      }  
  
      protected void onSizeChanged(int w, int h, int oldw, int oldh) {
          //Error, because I need to use extends View for class, but I can't do it because I also need extends Activity to use onCreate
      }
  }
  </code></pre>
  
  <p>If I use MyClass extends Activity I can use onCreate but not onSizeChanged.<br>
  If I use MyClass extends View I can use onSizeChangedbut not onCreate.</p>
  
  <p>How can I solve the problem?</p>