Start Activity in a Fragment
I want to start an activity in a fragment and the ac开发者_Go百科tivity is just like any other installed applications. eg. Email.
I get the intent of that application from PackageManager, now I want to start that activity in my seperate Fragment. Whenever I use startActivityFromFragment
is starts the application in whole screen, but I want to start that activity limited in only that fragment.
What should I do?
Drop the idea as it doesn't really make sense and I can't see that it can be done anyway.
For example if you have a dual-pane layout and want to invoke the contacts app into the right fragment which itself uses a dual-pane layout along with making use of the application bar how would you expect it to look? It's the contacts app that is making the call to setContentView and deciding how to layout itself out, not your app. If I'm mistaken in what you mean and it's your activity then of course you can create a fragment from it and load into your required view.
精彩评论