Over a million developers have joined DZone.

Android Application Development in 15 Minutes (Tutorial 02)

DZone's Guide to

Android Application Development in 15 Minutes (Tutorial 02)

· Java Zone
Free Resource

Try Okta to add social login, MFA, and OpenID Connect support to your Java app in minutes. Create a free developer account today and never build auth again.

The last post (tutorial 01) was on Android Software Stack and Terminology. This post will be for beginners on Android applications, and will teach you fast mobile application development from Android Developer Tools (ADT) based on the Eclipse IDE.

1. Start ADT and then go file—> new –> Android Applications Project


2. Follow the wizard with give project name (other values can be defaults as it is)

3. You will get below project structure


4. As below UI, you can drag and drop text-edit and button


In this sample we will added button action to pick text in text-field that mobile user entering to to above text label to show.

5.  Go to text mode of above UI (res/layout/fragment_main.xml) and added below line to button, to pick action when button is click


6. Then write a function in MainActivity.java in 'src'

** Called when the user touches the button 
    publicvoid sendMessage(View view) {

      // Do something in response to button click            


7. No we will write code to read string on text-field and added to text label

/** Called when the user touches the button */ 
publicvoid sendMessage(View view) { // Do something in response to button click EditText editText = (EditText) findViewById(R.id.editText1); TextView textView = (TextView) findViewById(R.id.textView1); //getting string from edit text field String name = editText.getText().toString(); //adding string to text view / text label textView.setText(name); }

8. Now run application in phone and see is it working as we expected. You can use a hardware device to run it for tests also, and this post shows how: ‘Using Hardware Devices to Run Android App from IDE.’


9. Now we will look on real device. Yes, it works as we needed


10. Log message also to know, simple. You can add a log as below to your java method

Log.v("EditText", editText.getText().toString());


  • tag: Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs
  • msg: The message you would like logged

Log filtering can be done by

  • ASSERT  - The println method.
  • DEBUG  - The println method; use Log.d.
  • ERROR  - The println method; use Log.e.
  • INFO  - The println method; use Log.i.
  • VERBOSE  - The println method; use Log.v.
  • WARN  - The println method; use Log.w.

Here I am looking console log from PC


Build and launch faster with Okta’s user management API. Register today for the free forever developer edition!


Published at DZone with permission of Madhuka Udantha, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}