5

Just out of curiosity, I wanted to know where on the file system of an Android device the application icons are stored.

Like I have shortcuts to various applications on the homescreen of my device, where those icons files (or images) are stored. Is it only inside the application package (.apk) or Android stores it some where else?

If it is in application package only does Android loads all the imagess from each of the apk and loads it when it is started for the first time?

4

2 回答 2

2

安装应用程序文件时,会分析 .apk 文件并由启动器提取各种信息。(此过程不涉及加载和运行应用程序本身。)其中包括应用程序图标,启动器通常将其缓存在其自己的私有区域中。具体如何完成取决于您设备上当前处于活动状态的启动器。您可能可以浏览启动器的源代码,以了解有关它如何缓存从应用程序 .apk 文件中提取的这些项目的更多详细信息,但我不确定该练习有什么实际用途。

启动器使用自己的缓存极大地加快了启动速度,否则每次重新启动时都必须扫描每个已安装的应用程序,以提取启动器显示自身所需的信息。但是,缓存是偶尔出现问题的根源,例如安装更新的应用程序(带有新图标和可能的新应用程序名称)时图标不会立即更新。(例如,参见这个线程这个线程。)

于 2014-05-22T18:27:03.450 回答
1

想想当你创建自己的应用程序时会发生什么。通常,您为您的应用程序为所有可绘制资源桶(或至少您想要支持的那些)创建图标。然后这些文件与 AAPT 一起打包到项目的其余部分的 apk 中。然后在安装您的应用程序后,操作系统将选择与您的手机配置匹配的图标,并在您已安装的应用程序页面上创建一个快捷方式。

于 2014-05-22T14:42:42.353 回答