运行安卓虚拟机时老是提示unfortunately,xx has stopped
1个回答
展开全部
package android.activity_intent;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.content.Intent;
public class Activity_Intent extends Activity {
/** Called when the activity is first created. */
private Button myButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myButton=(Button)findViewById(R.id.myButtonId);
myButton.setOnClickListener(new MyButtonListener());
}
//监听器
class MyButtonListener implements android.view.View.OnClickListener{
public void onClick(View v) {
// TODO Auto-generated method stub
//生产一个Intent对象
Intent intent=new Intent();
intent.setClass(Activity_Intent.this, Intent.class);
Activity_Intent.this.startActivity(intent);
}
}
}
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.content.Intent;
public class Activity_Intent extends Activity {
/** Called when the activity is first created. */
private Button myButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myButton=(Button)findViewById(R.id.myButtonId);
myButton.setOnClickListener(new MyButtonListener());
}
//监听器
class MyButtonListener implements android.view.View.OnClickListener{
public void onClick(View v) {
// TODO Auto-generated method stub
//生产一个Intent对象
Intent intent=new Intent();
intent.setClass(Activity_Intent.this, Intent.class);
Activity_Intent.this.startActivity(intent);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询