Android 4.4 App Development Essentials was published on January 23, 2014. The current revision is 2.1. The revision of your copy of the book can be found in the copyright page at the start of the book.
IMPORTANT - New Project Wizard now Creates a Fragment Layout
A recent update to the Android ADT Plug-in now requires that a fragment layout file be specified when a new project is created. As a result many of the steps outlined in the book no longer match the default behavior of the Eclipse/ADT bundle.To resolve this problem, follow these steps when creating new projects:
1. Enter the same layout name into both the "Layout Name" and "Layout Fragment Name" fields in the Blank Activity configuration screen of the New Android Application Wizard.
2. Once the new project has been created, edit the onCreate() method of the main Activity Java file and remove the following lines:
if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); }Having made these changes, the tutorials in the book will work as written.
Section 26.3 - Implementing beginDelayedTransition Animation
The code for the onCreate() method omits the following line:myLayout = (ViewGroup) findViewById(R.id.myLayout);The full method should, therefore, read as follows:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transition_demo); myLayout = (ViewGroup) findViewById(R.id.myLayout); myLayout.setOnTouchListener( new RelativeLayout.OnTouchListener() { public boolean onTouch(View v, MotionEvent m) { handleTouch(); return true; } } ); }
If you have encountered an error in this book not listed above, please let us know by contacting our support team at [email protected].