Reputation: 11471
I created a layout in my myviewlay.xml but this is not working, what am i missing?
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
imageBack = BitmapFactory.decodeResource(getResources(), R.layout.myviewlay, null);
}
Upvotes: 0
Views: 2465
Reputation: 2660
Add this to do the actual drawing:
canvas.drawBitmap(imageBack, x, y, mPaint); //replace x,y,and mPaint with whatever you need to.
However, if you're trying to display an entire layout use setContentView(imageBack)
or something similar. It's recommended to do your layout in XML.
Update: Sorry I misunderstood you at first. It looks like you ARE trying to inflate a layout from XML. In that case, in your onCreate(), call setContentView(R.layout.myviewlay);
Upvotes: 2