這裏是片段的對話框:getFragmentManager()返回null,與android.support.v4.app.DialogFragment支持libraray
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");
任何想法爲什麼它是空的?