Java Programming for Android Developers For Dummies, 2nd Edition

by Barry Burd

This page is for the second edition of the book. If you have the first edition, please visit the 1st edition web page.

Download the code examples!

If you're seeing an error message such as "String types not allowed", please try this:

  1. Expand the app/res/layout branch on the left side of the Android Studio window and double-click the activity_main.xml branch.
  2. With two tabs labeled Text and Design in the Editor area, click the Text tab. You should see the text of the activity_main.xml file.
  3. In the activity_main.xml file, find the lines that start with the letters xmlns. Add this line after the last one of those lines:
    		        android:id="@+id/activity_main"
    		
  4. In the activity_main.xml file, find the four lines that look like this:
    		        app:layout_constraintLeft_toLeftOf="parent"
    		        app:layout_constraintTop_toTopOf="parent"
    		        app:layout_constraintRight_toRightOf="parent"
    		        app:layout_constraintBottom_toBottomOf="parent"
    		
  5. Change the word "parent" in each of these lines like so:
    		        app:layout_constraintLeft_toLeftOf="@+id/activity_main"
    		        app:layout_constraintTop_toTopOf="@+id/activity_main"
    		        app:layout_constraintRight_toRightOf="@+id/activity_main"
    		        app:layout_constraintBottom_toBottomOf="@+id/activity_main"
    		

Talk to me:

Tweets by @allmycode

How to verify that a device (a phone or a tablet) is properly connected to your development computer via USB

Errata

.

.

.

.

.

.

.