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.
For any other books by Barry Burd, visit my main page.

Download the code examples!   Find out how to run this book's examples with newer versions of Android and Android Studio

Note: I'm not a lawyer but, as I understand it, the version of Java at Oracle's web site is still free to use if you're using it only to practice writing Java code. You can't use it for free to put an application into production. If you want a completely free version of Java, visit adoptium.net.

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

.

.

.

.

.

.

.