Search code examples
androidandroid-fragmentsbroadcastreceiver

Share Fragment from external application


I am creating an application with plugins architecture. I am discovering new plugins with BroadcastReceiver - if plugin is notified about introducing itself, it sends back name, data provider and preferences fragment's cannonical name (for example: mobi.hsz.project.plugin.foo.FooFragment)

I would like to adopt this fragment in my PreferenceActivity so if user clicks on plugin item in list - I would like to load this specified fragment. Is it event possible to load external fragment into my Fragment Manager ?

It works well if I pass new Intent from plugin and start it with startActivity in my application, however it breaks fragment design pattern.

The best solution is to start new intent inside some empty fragment, so it will looks like it's a part of my application but holds different application context. Can we display new intents inside fragment, not new 'window'?


Solution

  • Is it event possible to load external fragment into my Fragment Manager ?

    No, sorry.

    Can we display new intents inside fragment, not new 'window'?

    Not in any sort of reliable fashion.