2009-07-10 129 views
3

我在android应用程序开发中开始使用helloword应用程序。但我无法在android模拟器中看到输出。它只会在模拟器屏幕上显示android。我只是打印“来自Brijesh的你好”。但它不会显示在Android的模拟器中。实际上,我遵循以下链接中的说明。 http://developer.android.com/guide/tutorials/hello-world.html 但没有出柜。 任何人都可以帮助我。Android模拟器输出

thankx。

+0

有很多你可能不会看到输出的原因。模拟器是否启动?操作系统是否加载?你可以在Android模拟器中导航(比如说启动网页浏览器)吗?程序的图标是否显示在启动器中?如果你缩小了发生的事情,而且没有发生,我们可能会帮助你。 – Will 2009-07-10 19:44:31

回答

12

如果我理解正确,你想输出一些调试信息到屏幕上? 在标准的java中,你可以使用System.out.println方法,但是对于android我建议你使用Dalvik调试器。

用途:

Log.i("mytag","My simple message"); 

,并通过使用在Dalvik调试监视器

开始在Dalvik调试监视器具有SE输出:

c:\android-sdk\tools\ddms.bat 

只要改变文件夹名到已安装位置SDK。

现在调试器应用程序将启动(在模拟器旁边),并且您的消息将以绿色文本显示。

+0

非常感谢它现在完成。 – 2009-07-10 11:28:14

1

您还可以通过为包含“System.out”的日志标记创建过滤器来查看Dalvik Debug Monitor或LogCat中的System.out.println命令。

0

如果要通过XMl打印“Brijesh的Hello”,请使用此代码。

 <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="@string/hello_world" 
     /> 

如果你想打印用java然后,

 TextView tv = new TextView(this); 
     //Set a text into view 
     tv.setText("Hello World"); 
     //set the view into activity view container 
     setContentView(tv);