这是片段对话框:
import android.support.v4.app.DialogFragment;
public static class SensorMeasurmentsDialogFragment extends DialogFragment {
public static SensorMeasurmentsDialogFragment newInstance(int title) {
SensorMeasurmentsDialogFragment frag = new SensorMeasurmentsDialogFragment();
Bundle args = new Bundle();
args.putInt("title", title);
frag.setArguments(args);
return frag;
@Override public Dialog onCreateDialog(Bundle savedInstanceState) {
.....
}
}
}
对它的调用是从常规活动而不是从 fragmentActivity 完成的,因为我的活动已经扩展了 mapActivity。
m_measurmentDlg=SensorMeasurmentsDialogFragment.newInstance(R.string.app_name);
m_measurmentDlg.show(m_measurmentDlg.getFragmentManager(),"measurments");
知道为什么它是空的吗?