List of usage examples for android.view SurfaceView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.chrulri.droidoflife.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//from www.j av a2s.c o m getSupportActionBar().setDisplayShowHomeEnabled(false); settingsCache = SettingsActivity.loadSettings(this); SurfaceView view = (SurfaceView) findViewById(R.id.main_surfaceView); surface = view.getHolder(); restartRuntime(); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // disable iteration task for manual mode if (iterationTask != null) { iterationTask.cancel(false); iterationTask = null; } else { doIteration(); } refreshTitle(); } }); surface.addCallback(new SurfaceHolder.Callback() { @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { doRender(); } @Override public void surfaceCreated(SurfaceHolder holder) { doRender(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { // ignore } }); refreshTitle(); // Manual // TODO show manual }