A
A
Alexander Vasyuchenko2016-09-14 08:59:41
Android
Alexander Vasyuchenko, 2016-09-14 08:59:41

How to use android.support.v4.app.Fragment and android.app.Fragment in one activity?

Good afternoon!
Can you please tell me if it is possible to use two different fragments (old and new) in the same activity?
android.support.v4.app.Fragment and android.app.Fragment

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Gapchenko, 2016-09-14
@alexv1981

It is forbidden.
AppCompatActivity spawns a FragmentManager from the support library, which, in turn, can only work with Fragment from the support library.
A regular Activity spawns a FragmentManager from the SDK, which, in turn, can only work with a Fragment from the SDK.

T
Tsimur_S, 2016-09-14
@Tsimur_S

Take it and try it. Who's stopping you? Use the fully qualified class name (with package) when declaring fields/variables, instead of importing, to avoid name conflicts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question