Android Community
Results 1 to 3 of 3

Thread: how to print message on console

  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Default how to print message on console


    hello
    i am new to android.
    can any1 tellme how can we display message on android's console...like we print msg in j2me by System.out.println
    what we use for android as System.out is not works on android.
    and how can we handle events in android.

  2. #2
    Join Date
    Apr 2009
    Posts
    5

    Default Re: how to print message on console

    to post text on the screen you can make a text view and then call setText("").

    for events, you need to add an event handler. lets use a button for example:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout androidrientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <Button android:id="@+id/Button1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="clickme"
    />
    </LinearLayout>



    public class yourApp extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button Button1 = (Button) findViewById(R.id.Button1);
    Button1.setOnClickListener(button1ClickEvent);
    }

    // Button events
    private OnClickListener button1ClickEvent = new OnClickListener()
    {
    public void onClick(View v)
    {
    // handle click
    }
    };
    }

  3. #3

    Default Re: how to print message on console


    @dre_b
    the given code is not printing anything on console of eclipse....
    its for printing any stuff on UI of android phone........
    dats d basic code n a very common android app code...

    some1 post some real code for writing anything on console as it hepls in debuggin d code very easily...
    u cant configure eveythng frm UI to .java file.......

Similar Threads

  1. Atl X console
    By ggrant3876 in forum Developers Guild
    Replies: 6
    Last Post: 07-07-2009, 05:08 PM
  2. recovery console
    By barger01 in forum General Phone Chat
    Replies: 3
    Last Post: 05-08-2009, 08:02 PM
  3. cant go to recovery console?
    By PitchDarkShadow in forum General Phone Chat
    Replies: 8
    Last Post: 04-30-2009, 12:11 AM
  4. Google Docs: Print from phone
    By endmp25 in forum Developers Guild
    Replies: 2
    Last Post: 12-17-2008, 03:47 AM
  5. Fine print on data plan
    By ariesboy in forum General Phone Chat
    Replies: 8
    Last Post: 09-23-2008, 01:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •