Question: I'm trying to convert my application into Mono so I can use it with Mac - but I'm not sure what's the best way to work with database. Currently i'm using EF6 - but i read few posts saying that it's not working with Mono. I googled more - and there is paid provider which seem to support what I need: <http://www.devart.com/dotconnect/entityframework.html> - but I'm wondering if there are free alternatives?

Thank you.

Answer: 
The reason you get `0` is because the view has not been measured yet. To get the size of a layout, your should be using `getWidth()` or `getMeasuredWidth()` methods. However, these methods won't give you a meaningful answer until the view has been measured. Read about [how android draws views](http://developer.android.com/guide/topics/ui/how-android-draws.html) here.

You can get the correct size, by overriding the `onWindowFocusChanged()` as [mentioned in this thread](https://groups.google.com/forum/#!topic/android-developers/nNEp6xBnPiw).

Alternatively, you could do this:

```
@Override
public void onContentChanged() {
    super.onContentChanged();

    v = (View) getWindow().getDecorView().findViewById(android.R.id.content);

    v.post(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(MainActivity.this, "width of contentview " + v.getWidth()
                    + " " + "height of contentView " + v.getHeight(), Toast.LENGTH_SHORT).show();
        }
    });
}

```
You need to wait for the view to form/open completely, then you will get these values.Currently what happens is that your view is currently forming so that is why it is coming 0. You need to put some timer or handler such that this code will run after 2 ,3 seconds after your view has formed