kaay
kaay

Reputation: 1103

Fragments in AndroidManifest.xml?

com.google.android.gms.analytics.samples.mobileplayground has things like this in its AndroidManifest.xml:

<activity android:name=".EventFragment"
        android:label="@string/app_name"></activity>

Fragments in the manifest. That used to be a no-no, though it is being done now, apparently.
The Android docs are a vast maze of sometimes contradictory information, where can I get some reference (like this) - purpose, possibilities, limitations, etc?

[edit] Irritating that to disprove legit usage of Fragments in this way, we need someone of authority (google dev or someone very up-to-date on what they churn out), anyone else would just be guessing.

Upvotes: 0

Views: 12289

Answers (1)

Larry Schiefer
Larry Schiefer

Reputation: 15775

That's a confusing thing the sample does. It is technically invalid and accomplishes nothing as no part of the sample app tries to do a startActivity() for one of those and they are all non-exported because there's no <intent-filter> set for those entries. If they did have an intent filter set for them or something tries to activate it via an explicit Intent it would fail because that class is not an Activity. You cannot have a Fragment without a hosting Activity.

Upvotes: 3

Related Questions