我在android應用程序開發中開始使用helloword應用程序。但我無法在android模擬器中看到輸出。它只會在模擬器屏幕上顯示android。我只是打印「來自Brijesh的你好」。但它不會顯示在Android的模擬器中。實際上,我遵循以下鏈接中的說明。 http://developer.android.com/guide/tutorials/hello-world.html 但沒有出櫃。 任何人都可以幫助我。Android模擬器輸出
thankx。
我在android應用程序開發中開始使用helloword應用程序。但我無法在android模擬器中看到輸出。它只會在模擬器屏幕上顯示android。我只是打印「來自Brijesh的你好」。但它不會顯示在Android的模擬器中。實際上,我遵循以下鏈接中的說明。 http://developer.android.com/guide/tutorials/hello-world.html 但沒有出櫃。 任何人都可以幫助我。Android模擬器輸出
thankx。
如果我理解正確,你想輸出一些調試信息到屏幕上? 在標準的java中,你可以使用System.out.println方法,但是對於android我建議你使用Dalvik調試器。
用途:
Log.i("mytag","My simple message");
,並通過使用在Dalvik調試監視器
開始在Dalvik調試監視器具有SE輸出:
c:\android-sdk\tools\ddms.bat
只要改變文件夾名到已安裝位置SDK。
現在調試器應用程序將啓動(在模擬器旁邊),並且您的消息將以綠色文本顯示。
非常感謝它現在完成。 – 2009-07-10 11:28:14
您還可以通過爲包含「System.out」的日誌標記創建過濾器來查看Dalvik Debug Monitor或LogCat中的System.out.println命令。
如果要通過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);
有很多你可能不會看到輸出的原因。模擬器是否啓動?操作系統是否加載?你可以在Android模擬器中導航(比如說啓動網頁瀏覽器)嗎?程序的圖標是否顯示在啓動器中?如果你縮小了發生的事情,而且沒有發生,我們可能會幫助你。 – Will 2009-07-10 19:44:31