7.4. MainActivity Class

This app consists of six classes:

MainActivity (Fig. 7.11)—Serves as the parent Activity for this app’s Fragments.

 1   // MainActivity.java 2   // Sets MainActivity's layout 3   package com.deitel.doodlz; 4  5   import android.app.Activity; 6   import android.content.pm.ActivityInfo; 7   import android.content.res.Configuration; 8   import android.os.Bundle; 9 10   public class MainActivity extends Activity11   {12      @Override13      protected void onCreate(Bundle savedInstanceState)14      {15         super.onCreate(savedInstanceState);16         setContentView(R.layout.activity_main);17 18         // determine screen size19         int screenSize =20            getResources().getConfiguration().screenLayout ...

Get Android™ How to Program, 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.