
- #Simple android program in java install
- #Simple android program in java android
- #Simple android program in java code
#Simple android program in java android
Select API 17: Android 4.2 (Jelly Bean) as the platform to compile the project. Select API 17: Android 4.2 (Jelly Bean) as the Target Platform, as we expect this to be the version commonly used by your target audience.
#Simple android program in java install

Now let's create the same application in Android. After the user types a name and presses Enter, the welcome message is displayed with the entered name, as shown in Figure 1.įigure 1 Output of the Java program Creating an Android Project Similar to the Java Program When the program is run, it asks the user to enter a name. The entered name is then displayed on the screen by statement #8. Statements #5 and #6 ask the user to enter a name that is then assigned to the string name.

Statement #4 defines a try.catch block to check for any errors that might have occurred while the reader entered the text. Statement #3 uses the istream reader to convert the data into string form. The entered text is stored in the form of Unicode characters. The reader will read from the standard input stream ( System.in) that is, from the keyboard. Statement #2 creates a reader called istream. In WelcomeMsg.java, statement #1 imports the packages required for input/output operations. InputStreamReader istream = new InputStreamReader(System.in) #2īufferedReader bufRead = new BufferedReader(istream) #3 For example, if the user enters the name "Kelly," the message, "Welcome Kelly!" appears on the screen. After entering the name, when the user presses Enter, a welcome message appears, including the name the user typed.
#Simple android program in java code
The code shown in Listing 1 is a simple Java program called WelcomeMsg.java that asks the user to enter a name. Learn More Buy Example: A Simple Java Program
