问题
I am running on helloword application as getting started with android application developement. but i cant able to see output in android emulator. it will show only android in the emulator screen. and i am just print "Hello from Brijesh". but it will not display in the emulator of the android. actually i follow the instruction in the following link.
http://developer.android.com/guide/tutorials/hello-world.html
but not getting out put.
can any one help me out.
thankx.
回答1:
If i understand correctly, you would like to output some debugging messages to the screen ?
In standard java you can use the System.out.println method, but with android i suggest you use the Dalvik debugger.
Use:
Log.i("mytag","My simple message");
And se the output by using the Dalvik Debug Monitor
Start the Dalvik Debug Monitor with:
c:\android-sdk\tools\ddms.bat
Just change the foldername to where you have installed the SDK.
Now the debugger application will start (next to the emulator), and your message will be shown with green text.
回答2:
You can also view System.out.println commands in the Dalvik Debug Monitor or in LogCat by creating a filter for a Log Tag containing "System.out".
回答3:
If you want to print "Hello from Brijesh" through XMl then use this code.
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
/>
And if you want to print that using java then,
TextView tv = new TextView(this);
//Set a text into view
tv.setText("Hello World");
//set the view into activity view container
setContentView(tv);
来源:https://stackoverflow.com/questions/1108820/android-emulator-output