从零开始搭建Android手机系统开发环境
2010-12-18 08:03:51 来源:WEB开发网核心提示:六、创建测试程序打开Eclispe的开发环境,选择File->New->Project->Android->Android Project编写Java程序HelloAndroidpackage cn.younext;import android.app.Activity;import andro
六、创建测试程序
打开Eclispe的开发环境,选择File->New->Project->Android->Android Project


编写Java程序


HelloAndroid
package cn.younext;
import android.app.Activity;
import android.widget.TextView;
import android.os.Bundle;
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 Android, I'm chunting");
setContentView(tv);
}
}
运行Run->Run Configurations

在Target中选择创建的AVD,点击Apply,最后点击Run

最终的效果图如下:
