从URL下载图像并将其保存在我的应用程序的drawable-hdpi文件夹中

时间:2021-03-23 00:22:30

I need to download an image from url and save it in the app's drawable-hdpi folder and then show it in ImageView. How I can do it?

我需要从url下载一个图像并将其保存在app的drawable-hdpi文件夹中,然后在ImageView中显示它。我怎么能这样做?

I tried using this and this code but it's not a good solution for me because this code saves on the SDCard.

我尝试使用这个和这个代码,但它对我来说不是一个好的解决方案,因为这个代码保存在SDCard上。

1 个解决方案

#1


5  

You cannot save in the app package. You only have these options:

您无法保存在应用包中。您只有以下选项:

Your data storage options are the following:

您的数据存储选项如下:

Shared Preferences Store private primitive data in key-value pairs. Internal Storage Store private data on the device memory. External Storage Store public data on the shared external storage. SQLite Databases Store structured data in a private database. Network Connection Store data on the web with your own network server.

共享首选项将私有原始数据存储在键值对中。内部存储将私有数据存储在设备内存中。外部存储将公共数据存储在共享外部存储上。 SQLite数据库将结构化数据存储在私有数据库中。网络连接使用您自己的网络服务器在Web上存储数据。

more information: http://developer.android.com/guide/topics/data/data-storage.html

更多信息:http://developer.android.com/guide/topics/data/data-storage.html

#1


5  

You cannot save in the app package. You only have these options:

您无法保存在应用包中。您只有以下选项:

Your data storage options are the following:

您的数据存储选项如下:

Shared Preferences Store private primitive data in key-value pairs. Internal Storage Store private data on the device memory. External Storage Store public data on the shared external storage. SQLite Databases Store structured data in a private database. Network Connection Store data on the web with your own network server.

共享首选项将私有原始数据存储在键值对中。内部存储将私有数据存储在设备内存中。外部存储将公共数据存储在共享外部存储上。 SQLite数据库将结构化数据存储在私有数据库中。网络连接使用您自己的网络服务器在Web上存储数据。

more information: http://developer.android.com/guide/topics/data/data-storage.html

更多信息:http://developer.android.com/guide/topics/data/data-storage.html