Coding the LiveDrawingActivity class
Let's get started with coding the Activity
-based class. We called this class LiveDrawingActivity,
and it was auto-generated for us when we created the project.
Add the first part of the code for the LiveDrawingActivity
class:
import android.app.Activity; import android.graphics.Point; import android.os.Bundle; import android.view.Display; public class LiveDrawingActivity extends Activity { private LiveDrawingView mLiveDrawingView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); mLiveDrawingView = new LiveDrawingView( this, size.x, size.y); setContentView(mLiveDrawingView); ...
Get Android Programming for Beginners - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.