O'Reilly logo

Android Programming for Beginners by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Expressing yourself demo app

Let's try using some declarations, assignments, and operators. When we bundle these elements together into some meaningful syntax, we call it an expression. So let's write a quick app to try some out. We will then use Toast and Log to check our results.

Create a new project called Expressing Yourself, use a Blank Activity, and leave all the other settings at their defaults. The completed code that we will write in this project can be found in the Chapter 7/Expressing Yourself folder of the download bundle.

Switch to the MainActivity tab in the editor and we will write some code. In the onCreate method, just before the closing curly brace }, add this code:

int numMessages;

Directly below the previous line of code we will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required