2 sinat 19868271 sinat_19868271 于 2014.10.10 01:31 提问

空指针 不知空哪 大神求助!!!

10-09 16:32:51.083: E/AndroidRuntime(766): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.weightcount/com.example.weightcount.resultView}: java.lang.NullPointerException

相关代码:
public class resultView extends MainActivity {
private TextView resultView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result1);
    resultView = (TextView)findViewById(R.id.result);
    Intent intent = getIntent();
     final String factorstr = intent.getStringExtra("one");


     final RadioButton radio1 =(RadioButton)findViewById(R.id.Sex_man);
    RadioButton radio2 =(RadioButton)findViewById(R.id.Sex_woman);
    RadioGroup radiogroup = (RadioGroup)findViewById(R.id.radiogroup);
    radiogroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup arg0, int arg1) {
             int factorstrint = Integer.parseInt(factorstr);
            // TODO Auto-generated method stub
            if(arg1==radio1.getId()){

                int weight = factorstrint-105 ;


                resultView.setText(weight+" ");

1个回答

qq429205464
qq429205464   2014.10.10 10:47

能调试不,在你认为不正常的地方加个断点调试下就知道啦,不能调就打印一下trace日志看走到哪里了

sinat_19868271
sinat_19868271 不能确定范围额 大神能指几个地方不
大约 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片