getResources().getIdentifier() 方法是否足够有效以在 ListView 中使用它?

Is getResources().getIdentifier() method efficient enough to use it in a ListView?

关于应用程序的一些信息:

该应用程序在可绘制文件夹中包含大量图像。 每张图片的大小在 1kb 到 3kb 之间。 我需要将它们绘制到 ListView 中。

我需要得到的东西:

我需要将图像的标识符 (R.drawable.my_image) 与一些其他用户信息一起存储到数据库中。

问题:

当我更新应用程序(添加新的图片资源)时,标识符可能会发生变化。因此,在数据库中我将​​有一个过时的标识符,它链接到一个不存在的资源。

我想将 资源名称 存储在数据库中而不是 资源标识符 我将通过 getResources().getIdentifier(String, String, String) 方法。但我不知道这种方法是否足够有效,可以在 ListView 中使用它。 文档说 Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

你知道其他解决方案吗?

在列表视图中使用它效率不高。

Resources.getIdentifier方法的官方文档:

Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.

NOTE in documentation

Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

最后我使用 getResources().getIdentifier() 方法将图像加载到列表中(使用 recyclerview)。我的列表有大约 20 张图像。平均大小也小于 3kb。我已经在旧设备上尝试过该应用程序(行为会受到他的 CPU 的影响)并且运行良好。我知道不推荐使用此方法,但可以作为解决方案。