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

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!  Brought to you in partnership with CA Technologies

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


CA App Experience Analytics, a whole new level of visibility. Learn more. Brought to you in partnership with CA Technologies.


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

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


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

{{ parent.tldr }}

{{ parent.urlSource.name }}