Max
Max

Reputation: 348

DialogFragment error with support library

I have made a dialog and it is working great if I use android.app.DialogFragment to create it and let it show with

DialogFragment fragment = new HelpDialogFragment();
fragment.show(getFragmentManager(), "helpdialog");

But... if I use android.support.v4.app.DialogFragment as import instead, following error comes up:

"There is no applicable method to (android.app.FragmentManager, java.lang.String)", which is weird. I can't just use android.app, because this would display the dialog in holo on devices with Android 4.4.4 and below.

If you need more files or parts of the .java file, feel free to tell me in the comments.

Upvotes: 0

Views: 1256

Answers (2)

QuokMoon
QuokMoon

Reputation: 4425

If you use getSupportFragmentManager() you need to extend FragmentActivity or extend ActionBarActivity (extends FragmentActivity) as FragmentActivity is the base class for support based fragments.

Your class might be extend with Activity and it's not identical at this super class android.support.v4.app.FragmentManager .

Upvotes: 0

hata
hata

Reputation: 12473

Maybe, you have to use android.support.v4.app.FragmentManager with android.support.v4.app.DialogFragment.

DialogFragment fragment = new HelpDialogFragment();
fragment.show(getSupportFragmentManager(), "helpdialog");

Upvotes: 1

Related Questions