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+" ");