求助!!怎么使用Radiogroup控件模拟心理测试类APP

利用eclipse软件进行Android开发,要求是用Radiogroup控件来模拟心理测试类的APP,不需要把所有的做出来,只要src包里的.Java 代码。
我只做出来一个Radiogroup的页面,,在不切换界面的前提下,怎样在APP运行之后,选择完第一题之后,文本跳转下一题?

package com.centent.mem;

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

public class MainActivity extends Activity {
RadioGroup radioGroup1;
RadioButton radio0,radio1,radio2,radio3;
TextView textView2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
radioGroup1 = (RadioGroup) findViewById(R.id.radioGroup1);
radio0 = (RadioButton) findViewById(R.id.radio0);
radio1 = (RadioButton) findViewById(R.id.radio1);
radio2 = (RadioButton) findViewById(R.id.radio2);
radio3 = (RadioButton) findViewById(R.id.radio3);
textView2 = (TextView) findViewById(R.id.textView2);
radioGroup1.setOnCheckedChangeListener(new OnCheckedChangeListener() {

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
if(checkedId == R.id.radio0)
textView2.setText("您选择的是:火车");
if(checkedId == R.id.radio1)
textView2.setText("您选择的是:飞机");
if(checkedId == R.id.radio2)
textView2.setText("您选择的是:轮船");
if(checkedId == R.id.radio3)
textView2.setText("您选择的是:步行");
}
});
}

@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;
}

}


思考:一个radiogroup,切换多个文本,,进行类似心理测试选项题。(字符数组)

全部评论
看不懂,帮顶
点赞 回复 分享
发布于 2015-04-02 09:20

相关推荐

流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务