Rohit Surwase
Rohit Surwase

Reputation: 711

use activity class as a fragment class from another activity dynamically

I have some activities that extends AppCompatActivity. In my app there is a viewPager and I want some of my previous activity with their ui and functionality in this viewPager. How can I convert activity to fragment at runtime because I need that activities too.

Upvotes: 0

Views: 56

Answers (1)

Bryan Herbst
Bryan Herbst

Reputation: 67259

You cannot simply make your Activity into a Fragment at runtime.

You will need to re-implement your UI using a different pattern, perhaps making the re-usable pieces of your Activity into a Fragment instead.

Upvotes: 1

Related Questions