Android Community
Results 1 to 3 of 3

Thread: easy one: how do I write text to canvas for debugging?

  1. #1
    Join Date
    Sep 2009
    Posts
    10

    Default easy one: how do I write text to canvas for debugging?


    Can I just create a textview object and write it to the canvas or do I need to create a layout that inludes the textview in its own area?

    A code sample would really help. Thanks.

  2. #2
    Join Date
    May 2009
    Posts
    8

    Default Re: easy one: how do I write text to canvas for debugging?

    Not sure if this is what you mean, but you can set the ContentView to your textview object:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView greeting= new TextView(this);
    greeting.setText("Hello World!");
    setContentView(greeting);
    }

    Of course, this is generally not considered good programming practice. It's usually better to isolate view from the data, etc.

  3. #3
    Join Date
    Jun 2009
    Posts
    24

    Default Re: easy one: how do I write text to canvas for debugging?


    For debugging I generally use Log.v -- the output goes to the DDMS LogCat window. You can also add a LogCat view in Eclipse (Window/Show View/LogCat).

    Cheers,
    Steve

Similar Threads

  1. Text easy
    By robmpulse in forum All About Andorid Software
    Replies: 3
    Last Post: 10-22-2009, 09:39 PM
  2. SMS/MMS forward to Twitter - Should I write it ?
    By textlogic in forum Developers Guild
    Replies: 2
    Last Post: 07-20-2009, 05:36 AM
  3. can't write to sdcard?
    By colonelcack in forum General HTC Chat
    Replies: 2
    Last Post: 05-13-2009, 11:48 PM
  4. anybody good at debugging?
    By dippedinsauce in forum Developers Guild
    Replies: 19
    Last Post: 04-03-2009, 04:41 PM
  5. debugging the android device?
    By booyaka in forum General Phone Chat
    Replies: 0
    Last Post: 11-26-2008, 08:19 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
  •