I tried a similar thing and posted in this Android theme : user interface elements on top of the canvas layer
Besides the above, you will also need this to get the height and width
public void onDraw(Canvas canvas)
{
this.canvas = canvas;
if (!oneTime)
{
oneTime = true;
screenWidth = getWidth();
screenHeight = getHeight();
Bitmap red = BitmapFactory.decodeResource(getResources(), R.drawable.image);
red = Bitmap.createScaledBitmap(red, screenWidth , screenHeight , true);
}
}
If you do not want to pull your code in OnDraw, you can try under the code
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenHeight = metrics.heightPixels;
int screenWidth = metrics.widthPixels;