ApplicationInfo和PackageInfo之间的区别?区别、ApplicationInfo、PackageInfo

2023-09-07 14:02:07 作者:风随心动

我对ApplicationInfo和PackageInfo班几个一般性的问题。在这里,他们是:

可有人形容ApplicationInfo之间的差异PackageInfo?他们如何彼此相关?在哪些情况下ApplicationInfo使用,用于PackageInfo什么时候?

感谢您的帮助!

编辑:

首先,发布有关我读过官方文档和Google搜索的问题前。这里有一些是我不清楚其他问题。对不起,也许我没有适当地问他们:

PackageInfo可以有NULL值ApplicationInfo对象。当有可能吗? (我想这是与卸载连接包) ApplicationInfo包含应用程序的UID。有没有可能PackageInfo没有UID(当ApplicationInfo为空?)。

所以这类问题。我不明白这些连接。

解决方案

能有人形容ApplicationInfo之间的差异,PackageInfo?

PackageInfo重新presents整个AndroidManifest.xml.ApplicationInfo实际上是PackageInfo的一个字段/属性,只指的是应用程序标记。请参阅this.

他们如何彼此相关?

正如我前面提到ApplicationInfo实际上是PackageInfo的属性/场本身恰好是一个复杂的对象,有其自己的方法/字段。

在哪些情况下ApplicationInfo使用,用于PackageInfo什么时候?

要应用标签,我们使用ApplicationInfo.Data相关AndroidManifest.xml中的其余部分可以通过其他领域获得这可能与服务或actvities或广播接收器中访问信息/在PackageInfo类中的方法

Eclipse 新建包的时候它会给我自动生成一个package Info.java文件

I have several general question about ApplicationInfo and PackageInfo classes. Here they are:

Can someone describe the difference between ApplicationInfo and PackageInfo? How do they correlate with each other? In which cases ApplicationInfo is used and when PackageInfo is used?

Thank you for the help!

EDIT:

First of all, before posting such a question I've read official documentation and googled. Here are some additional questions that are unclear to me. Sorry, maybe I did not ask them appropriately:

PackageInfo can have ApplicationInfo object with NULL value. When it is possible? (I guess this is connected with the uninstalled packages) ApplicationInfo contains uid of the application. Is it possible that PackageInfo does not have uid (when ApplicationInfo is null?).

So these kind of questions. I do not understand these connections.

解决方案

Can someone describe the difference between ApplicationInfo and PackageInfo?

PackageInfo represents the entire AndroidManifest.xml.ApplicationInfo is actually a field/attribute of PackageInfo,refering only to the application tag. Refer this.

How do they correlate with each other?

As I mentioned ApplicationInfo is actually an attribute/field of PackageInfo which itself happens to be a complex object and has its own methods/fields.

In which cases ApplicationInfo is used and when PackageInfo is used?

To access information within application tag which could be related to services or actvities or broadcast receivers we use ApplicationInfo.Data related to the rest of the AndroidManifest.xml can be obtained via the other fields/methods in PackageInfo class