What is the purpose of an activity announcement?

I do not ask how to declare or use any action, I am fine. I really wonder why actions exist even as declared elements, what is their purpose? Do I force the declaration of the elements that I use in two places (the manifest and the code itself), in some way should improve security?

+4
source share
2 answers

There are regular Java classes in the code. The export tool will need to determine which ones are expanding by Activity or FragmentActivity , or any subclass of these. And some may just be abstract. In any case, Android needs a list of all available Activity s.

By declaring them in the manifest, you have the opportunity to declare additional attributes and metadata that Android should know.

What Intent filters are available? In what mode do you want to start your Activity ? When to start Activity ? Android should know this.

Edit: Do not forget the permissions required to run single Activity s, as well as icons and labels - all that needs to be known.

+4
source

Actions are declared in Manifest, so Android can search when working with Intent.

The most outstanding idea is that you can make an Activity from another application part of the Activities stack. If this is confirmed by another application manifest.

+2
source

Source: https://habr.com/ru/post/1491508/


All Articles