当前位置:编程学习 > wap >>

android 第一次运行不显示内容

运行前查看过AVD都有,可就是不出效果
这是日志:
[2010-06-01 17:00:32 - helloWorld1] ------------------------------
[2010-06-01 17:00:32 - helloWorld1] Android Launch!
[2010-06-01 17:00:32 - helloWorld1] adb is running normally.
[2010-06-01 17:00:32 - helloWorld1] Performing com.eoewichina.helloWorld activity launch
[2010-06-01 17:00:32 - helloWorld1] Automatic Target Mode: Preferred AVD 'sdk_1_5_version' is not available. Launching new emulator.
[2010-06-01 17:00:32 - helloWorld1] Launching a new emulator with Virtual Device 'sdk_1_5_version'
[2010-06-01 17:00:51 - helloWorld1] New emulator found: emulator-5554
[2010-06-01 17:00:51 - helloWorld1] Waiting for HOME ('android.process.acore') to be launched...

运行出来一直显示是android ;并没有我要的“hello world!!"

望大家指证:
package com.eoewichina;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class helloWorld extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView tv=new TextView(this);
        tv.setText("hello world!!!!!!");
        setContentView(tv);
        
    }
}
这是运行的代码!!!!!! --------------------编程问答-------------------- 注释其中的  setContentView(R.layout.main); --------------------编程问答-------------------- setContentView(tv);

setContentView(R.layout.main);  这俩分别注释  再看看运行效果  思考下 --------------------编程问答-------------------- main.xml有一个LinearLayout对象
setContentView(R.layout.main);
在Activity中获取 LinearLayout layout=(LinearLayout)findView(R.id.layoutid)
 TextView tv=new TextView(this);
  tv.setText("hello world!!!!!!");
  layout.addView(tv); --------------------编程问答--------------------  把第一句setContentView注释掉试一下了
还有 LZ的问题究竟是系统启动不起来还是没程序启动不起来哦? --------------------编程问答-------------------- 顶一个,先获取其中的TextView ,TextView tv=(TextView)this.findViewById(R.id.text);
tv.setText("HelloWorld!!!");
试一下,应该是这样,与君共勉!!!! --------------------编程问答-------------------- 我现在也在纠结这个问题。
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,