从零开始搭建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
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352113.jpg)
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352951.jpg)
编写Java程序
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352832.jpg)
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352519.jpg)
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
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352537.jpg)
在Target中选择创建的AVD,点击Apply,最后点击Run
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352390.jpg)
最终的效果图如下:
![](http://tech.cncms.com/tech/UploadPic/20101218/201012188352483.jpg)
[]
赞助商链接