错误在活动中加入另一项活动“切换”
问题描述:
我得到了一些错误,我的主要活动代码添加另一项活动“切换”错误在活动中加入另一项活动“切换”
这里的时候,当我的代码:
package com.frede.fusrodah;
public class FusRoDAHActivity extends Activity {
@Override
public void onBackPressed() {
return;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
Button next = (Button) findViewById(R.id.button1);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FusRoDAH.class);
startActivityForResult(myIntent, 0);
Button next = (Button) findViewById(R.id.button4);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FusRoDAHnommusic.class);
startActivityForResult(myIntent, 0);
}
}
);
}
}
我得到了一些错误与一些“}”有人能帮我纠正它吗?
我写了这段代码,然后它有点坏了?
Button next = (Button) findViewById(R.id.button4);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FusRoDAHnommusic.class);
startActivityForResult(myIntent, 0);
答
希望这是您要寻找的....
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
Button next = (Button) findViewById(R.id.button1);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FusRoDAH.class);
startActivityForResult(myIntent, 0);
}
});
Button next2 = (Button) findViewById(R.id.button4);
next2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FusRoDAHnommusic.class);
startActivityForResult(myIntent, 0);
}
});
}
如果不是你想要做的是什么呢?
为什么你在另一个按钮的点击事件中嵌入一个按钮 – Ishu 2012-04-01 07:30:51