我的第一个Android程序

这是小生第一次在ITeye上发话,其实在新浪微博上已经关注蒋涛先生很久了。(PS:因为JavaEye被CSDN收购,而现在改名ITeye)。附上源代码:
package example.androidhelloworld;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv1=new TextView(this);
tv1.setText("Hello World!\nHello Android!\n
                                这是我编写的第一个安卓应用程序。");
setContentView(tv1);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

猜你喜欢

转载自yuemi1751.iteye.com/blog/1851714