What i want is, when i click on Dashboard Button it will open like a SlidingDrawer and after it opened when clicked on it again it will close. i use this custom drawer becau
When a View is first created, it's width and height are not available to you until onMeasure() has been called. Due to this, the first time you try to get the values, they have not been assigned yet.
Since you're using a custom View, the solution is pretty simple. Simply move the code that gets the height and width into onMeasure() and use it after that.
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
width = getWidth(); // Get View Width
height = getHeight();// Get View Height
}