I've created a class that extends a View:
public class BoardView extends View {
and I've specified the width and height of the BoardView in the application's main.xml file:
<mypackage.BoardView
android:id="@+id/board"
android:layout_width="270px"
android:layout_height="270px" />
I'm trying to get the width and height from a function that is called from the BoardView's constructor. Here's what I'm doing:
ViewGroup.LayoutParams p = this.getLayoutParams();
int h = p.height;
but getLayoutParams is always returning null. Any idea why this isn't working?