Android Open Source - Canvas-Test Main Canvas Activity

From Project

Back to project page Canvas-Test.


The source code is released under:

Apache License

If you think the Android project Canvas-Test listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package foobar.canvastest;
/* w  w  w . j a  v a  2*/
import android.os.Bundle;
import android.view.ViewGroup;
import foobar.canvastest.drawing.scenes.ExampleScene;

 * This is the main "Activity", the Android equivalent of a page or form.
 * Its UI corresponds to what is given in res/layout/main.xml
 * One of the elements, the actual MySurfaceView we draw on, is created
 * programatically as opposed to being in the xml. This is because it is a
 * custom class without any XML binding
public class MainCanvasActivity extends Activity {
  MySurfaceView mSurfaceView;

  /** Called when the activity is first created. */
  public void onCreate(Bundle savedInstanceState) {

    ViewGroup containerView = (ViewGroup)findViewById(;
    mSurfaceView = new MySurfaceView(this, new ExampleScene());


Java Source Code List