android 单击button按钮为什么没有跳转
packagecom.xiaoqu.e2;importandroid.app.Activity;importandroid.content.Intent;importan...
package com.xiaoqu.e2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
public class Select extends Activity implements OnClickListener{
ImageButton yhbutton=null;
ImageButton sjbutton=null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select);
yhbutton=(ImageButton)findViewById(R.id.yhbutton);
sjbutton=(ImageButton)findViewById(R.id.sjbutton);
}
@Override
public void onClick(View vie) {
// TODO Auto-generated method stub
if(vie==yhbutton){
Intent intent=new Intent();
intent.setClass(Select.this, Denglu.class);
startActivity(intent);
Select.this.finish();
}
else if(vie==sjbutton){
Intent intent=new Intent();
intent.setClass(Select.this, Shdenglu.class);
startActivity(intent);
Select.this.finish();
}
}
} 展开
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
public class Select extends Activity implements OnClickListener{
ImageButton yhbutton=null;
ImageButton sjbutton=null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select);
yhbutton=(ImageButton)findViewById(R.id.yhbutton);
sjbutton=(ImageButton)findViewById(R.id.sjbutton);
}
@Override
public void onClick(View vie) {
// TODO Auto-generated method stub
if(vie==yhbutton){
Intent intent=new Intent();
intent.setClass(Select.this, Denglu.class);
startActivity(intent);
Select.this.finish();
}
else if(vie==sjbutton){
Intent intent=new Intent();
intent.setClass(Select.this, Shdenglu.class);
startActivity(intent);
Select.this.finish();
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询