Vinoth
Vinoth

Reputation: 1349

Display a output statement on Android

My goal is to know which parts of my program is running. I usually do this by giving a "System.out.println" statement in Java. But since I am learning to develop applications in Android could someone please tell me the equivalent statement in Android. I do know that there is one statement called the "Toast.maketext().show();" but this is not working on some parts of my program.

Thank you

Upvotes: 0

Views: 1056

Answers (4)

Pankaj Kumar
Pankaj Kumar

Reputation: 82958

Use Log and to see your output of Logs enable LogCat as

Window -> Show View -> Other -> Android -> Logcat. (In eclipse)

More about Logs :

Reading and Writing Logs

Android logging

Edited :

You can make your own filter as

Let you are using Log.i("MyActivity", "Your message");

Process to create your own filter :

Goto Log view and click on 'create filter' enter image description here

Now one window will display as enter image description here

Now put your value as

Filter Name : Put any name here (This will display as tab name, as you can see in my screens TEST and TEST1.

by Log Tag : MyActivity

Left other as it is.

Now run your app and goto to Log cat. click on your own filter tab.

Upvotes: 2

Anu
Anu

Reputation: 89

you can use log such as private String TAG="your Activity name";

Log.d(TAG, " ################item.getCount() is################"+count );

In logcat you will get :- your Activity name ################item.getCount() is################ 4

In this way you can easily get your line.

Upvotes: 1

Randroid
Randroid

Reputation: 3698

Its simple, declare the constant first

  private static final String TAG = "HELLO VINOTH"; 

Then use this in ur coding so thatlogcat will show the messages with ur Nmae

 Log.v(TAG,"gender value on  male button click ="+gender );

Upvotes: 2

hackbod
hackbod

Reputation: 91331

Use android.util.Log, such as:

Log.i("MyClass", "This is some message");

The output is available in the logcat view of DDMS or from the command line with "adb logcat".

Upvotes: 3

Related Questions