public class HelloWorldActivity extends Activity 帮忙具体解释一下,新手,谢谢
publicclassHelloWorldActivityextendsActivity{/**Calledwhentheactivityisfirstcreated.*...
public class HelloWorldActivity extends Activity {
/** Called when the activity is first created. */
private Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.btn);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(HelloWorldActivity.this, "hello", 3000).show(); 展开
/** Called when the activity is first created. */
private Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.btn);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(HelloWorldActivity.this, "hello", 3000).show(); 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
推荐于2017-06-09
展开全部
public class HelloWorldActivity extends Activity implements OnClickListener{
private Button button;
/*继承Activity,必须实现onCreate方法
* 每一个Activity都要在AndroidManifest.xml中注册,
* */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button=(Button)findViewById(R.id.button);
button.setText("My Button");
button.setOnClickListener(this);
}
private Button button;
/*继承Activity,必须实现onCreate方法
* 每一个Activity都要在AndroidManifest.xml中注册,
* */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button=(Button)findViewById(R.id.button);
button.setText("My Button");
button.setOnClickListener(this);
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询