How to Add Buttons and Text to Your JavaFX Project
Getting Started with Java Programming
How to Compile a Java Program in TextPad

Java Android Programming Example Using Classes

Classes and subclasses are shown in a practical Java Android programming example here. How does an Android app use classes and subclasses? This example is ruefully simple, but it's one that an Android programmer sees every day. It's an Android Activity.

A typical Android app displays one screen at a time, as shown in the figure. A screenful of material might present the user with a list of options and a Start button. The next screenful (after the user clicks Start, for example) shows some helpful information, such as a map, a video, or a list of items for sale.

When the user touches on this information screen, the app's display changes to reveal a third screen, showing detailed information about whatever option the user selected. Eventually, the user dismisses the detail screen by clicking the Back button.

Android displays a sequence of screens.
Android displays a sequence of screens.

In Android terminology, each screenful of material is an activity. As the user progresses through the sequence of screens displayed in the figure, Android displays three activities. (It displays the middle activity twice — once after the user clicks Start and a second time after the user dismisses the detailed-info activity.)

Android developers deal with activities all the time, so the creators of Android have created an Activity class. The Activity class is part of Android's Application Programming Interface (API), the enormous library of classes that's available to every Android developer.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Use the JScrollPane Class to Create Text Areas with Scroll Bars in Java
Creating Properties More Efficiently in JavaFX
What Is Java, and Why Is It So Great?
Java Programming: Do You Have a 32-bit or 64-bit Operating System?
Logical Operators in Java
Advertisement

Inside Dummies.com