Your question became clear only by your last comment. In the code you specified above, you return using return bitmap . This will return the local bitmap variable. This local variable is completely empty. You can draw into a bitmap or associate an image with it, somewhere else in the code. But the bitmap instance in your above code is empty and only local to the function. You cannot expect it to return the updated, last bitmap.
Now, after your comment, I googled “get a bitmap of the current surface view” and this led me to this SO answer: Create a bitmap from SurfaceView
In this question, it was apparently resolved by extending the View instead of SurfaceView. The drawing cache works for presentation only.
Update: Follow the tutorials below. Based on the code you inserted, it is not clear what the error is. There is a lot to do to draw SurfaceView, and I'm not sure if you did this, and I cannot ask for every such missing item. I followed the tutorials for my main graphic projects. You should read them and see if you missed something.
Canvas Painting Tutorials:
Game with graphics in android all parts.
Android 2D
sanjeev mk
source share