Model Class System.out.print in Android

In java, if we want to print a value from variable or other process, we can use System.out.print() or System.out.println(). it’s always work in java, but when it try in android program, we can’t find it or System.out.print maybe can’t use in android. Android already give an alternative syntax for handle System.out.print from java, is Log class. Log class is coming from android.util.Log, That’s a reference library for use or take a Log class syntax.

Here an example : 

package com.apps.helloworld;

import android.os.Bundle;
import android.provider.Settings.System;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {

private EditText txtInggris;
private EditText txtIndonesia;
private EditText txtJerman;
public static final String INGGRIS = “Inggris”;
public static final String INDONESIA = “Indonesia”;
public static final String JERMAN = “Jerman”;
private Button btn;
private TextView tv;
AlertDialog al;

protected void onCreate(Bundle savedInstanceState) {

txtInggris = (EditText)findViewById(;
tv = (TextView)findViewById(;
btn = (Button)findViewById(;
al = new AlertDialog.Builder(this).create();

btn.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub

Log.d(“T”, “test”);
Log.i(“T”, “test lg”);
al.setButton(“Ok aja”, new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub


public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;


So, The result from the code will be showed in LogCat.

Here the result :

Result LogCat

Result LogCat


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s