Posted By

on 03/31/10


Tagged


Versions (?)

Example of Canvas


 / Published in: Java
 

from "Hello Android 2nd Edition" (ISBN: 1-934356-49-2)

  1. public class Graphics extends Activity {
  2. @Override
  3. public void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(new GraphicsView(this));
  6. }
  7.  
  8. static public class GraphicsView extends View {
  9. public GraphicsView(Context context) {
  10. super(context);
  11. }
  12. @Override
  13. protected void onDraw(Canvas canvas) {
  14. // Drawing commands go here
  15. }
  16. }
  17. }

Report this snippet  

You need to login to post a comment.