I have a content provider in my Android 3.1 Application, and are calling startActivity() with Intents that has content://my.package/xxx Uris, and Intent.ACTION_VIEW actions. In my andoroid-manifest.xml I have my content provider's mime-types set up so that my Activity picks up the intents. Evert thing works fine.
Here is my situation
- When an Activity with fragments is drawn, all fragments receive their life cycle events.
- I don't want all fragments to be redrawn/updated on the Intent. Because the incoming URI is usually just passed along to a the query method on my开发者_高级运维 content provider. The intent is usually only relevant to a specific fragment.
How do I stop things from happening in fragments that has nothing to do with the current Intent?
Can you post some code that's relevant to your problem? In particular, the portion of yoru Activity class code that deals with Fragment management, and the layout's .xml file?
If you are declaring the fragments directly in the layout's .xml
file, the fragments will be instantiated every time. If you do not want this behavior, instantiate and add fragments only programmatically (using FragmentTransacations
with the FragmentManager
in your activity code, and remove them from the .xml declaration.
精彩评论