我試圖在片段內創建DatePicker
並返回錯誤方法getSupportFragmentManager()
未定義類型CadastroModoVoo
。哪裏不對?方法getSupportFragmentManager()未定義爲類型CadastroModoVoo
XML:
<Button android:id="@+id/selectHora3Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:onClick="selectHora3"
android:text="Hora" />
類:
public class CadastroModoVoo extends Fragment {
private FragmentActivity context;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
cadastro_modo_voo = inflater.inflate(R.layout.cadastro_modo_voo, container, false);
context = getActivity();
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressLint({ "ValidFragment", "NewApi" })
public void selectHora3(View view) {
qual = 3;
DialogFragment newFragment = new SelectTimeFragment();
newFragment.show(getSupportFragmentManager(), "TimePicker"); -----> error
}