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);
}
Add this to do the actual drawing:
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);