我使用片段:
FragmentManager manager = getFragmentManager();
但我在日志猫中看到了这个错误:
12-30 21:14:05.500: E/AndroidRuntime(395):
java.lang.NoSuchMethodError:my.com.daily.Sign_upActivity.getFragmentManager
我的活动是:
public class sign_upActivity extends Activity implements AlertPositiveListener{
public String fonts="BZar.ttf";
private EditText fname,lname,birthdate,worktitle,company,username,pass,confpass,email,phone,phone1;
private Button signup;
private String gender;
private String education ,regiterDate,howIMF,expdate,active,picpath,deleted , expertise;
private RadioGroup radioGenderGroup;
private RadioButton radioGenderButton;
private Drawable error_indicator;
int position = 0;
int position1 = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_up);
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager manager = getFragmentManager();
AlertDialogRadio alert = new AlertDialogRadio();
Bundle b = new Bundle();
b.putInt("position", position);
alert.setArguments(b);
alert.show(manager, "alert_dialog_radio");
}
};
Button btn = (Button) findViewById(R.id.education_btn);
btn.setOnClickListener(listener);
}
@Override
public void onPositiveClick(int position) {
this.position = position;
TextView tv1 = (TextView) findViewById(R.id.education_tv);
tv1.setText(Education.code[this.position]);
education = Education.code[this.position];
}
}
谁能告诉我是什么原因?
非常感谢。我的问题在模拟器中解决了,但它在手机中强制关闭!我使用 minSdkVersion="4"