AnupamChugh
AnupamChugh

Reputation: 1899

Replace support v4 fragment with the older fragment

I need to replace android.support.v4.app.Fragment with android.app.Fragment. I am forced to use android.app.Fragment. How do I change my Fragment to inherit from android.app.Fragment instead of android.support.v4.app.Fragment?

Upvotes: 0

Views: 121

Answers (1)

C0D3LIC1OU5
C0D3LIC1OU5

Reputation: 8680

You can change the import statement to be android.app.Fragment instead of the one you are importing now every where you're using it (I'd start in your Fragment class). There will be a few other things you might need to change, like using FragmentManager instead of SupportFragmentManager to manage your Fragments, etc. You can fix or google how to fix the errors that arise when you change your Fragment descendant to extend the regular Fragment, not the support one.

EDIT: it's usually better to use support fragments. It would be worth looking into finding an alternative resolution to the problem that's forcing you to switch.

Upvotes: 1

Related Questions