Do I HAVE to declare every activity in a manifest file?

I want to create an Activity but not have to declare it in the manifest file. Is this possible? Everywhere I’ve seen it seems that every activity must be declared in the manifest, yet I notice that some activities, such as the built-in ChooserActivity, is not declared in my manifest file.

  • How to disable zoom in Chrome on Android?
  • Disable SSL as a protocol in HttpsURLConnection
  • Touch detection on polyline in Google Maps Android API v2
  • Android : AsyncTask, how can update ProgressDialog increment
  • Using GSON to parse json object vs json array
  • Android ViewPager scrolling issue with only one item when using getPageWidth from PagerAdapter
  • Related posts:

    How to show 3 dots at the end of text in textview
    How to hide action bar for fragment?
    How to check for Mock Location in Android Marshmallow?
    Android: Get application name (not package name)
    Building hybrid React apps for iOS and Android with native performance
    Unity Google Play Services Plugin API is not sync with Show Leaderboard UI function?
  • List events for specific day in Android 4+ (ALL_DAY issue)
  • How to get CPU usage statistics on Android?
  • Persisting a Collection class with ORMLite in android
  • Virtual device can not be deleted
  • Using GLSurfaceView class with android xml layouts
  • Any way to change the color of a radio button?
  • 2 Solutions collect form web for “Do I HAVE to declare every activity in a manifest file?”

    Short answer: yes, every Activity in your application must be declared in the manifest. As described in the Android docs, the purpose of the manifest (among other things) is:

    It describes the components of the application — the activities, services, broadcast receivers, and content providers that the
    application is composed of. It names the classes that implement each
    of the components and publishes their capabilities (for example, which
    Intent messages they can handle). These declarations let the Android
    system know what the components are and under what conditions they can
    be launched.)

    http://developer.android.com/guide/topics/manifest/manifest-intro.html#ifs

    Therefore any Activity class in your application must be defined in your Manifest. The same goes with Intents, Services etc. even if those components aren’t accessible from outside of your application.

    As for ChooserActivity and any other Activity which you didn’t define in code, they will have their own definitions in another Manifest. If for whatever reason you decide to subclass an existing Activity outside of your application, then you will have to define it in your Manifest too.

    I want to create an Activity but not have to declare it in the manifest file. Is this possible?

    No, sorry.

    I notice that some activities, such as the built-in ChooserActivity, is not declared in my manifest file

    That activity is not part of your application. It is part of the core operating system.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.