Three ways for Android to read server images

The Android link server provides three methods to obtain pictures, which have passed the verification and are correct.

Method 1:

In the first method, the data is obtained from the input stream of Conn and transformed into bitmap data.

In the function code:

Image is an ImageView type control.

The second method:

This method is similar to the method above. The settings in the function code are the same

The third method:

The third method stores the data obtained from the server into a local file. If the file already exists, it is not necessary to re obtain the data from the server. In the function code:

In the above code, set the picture as the cache setting, so that if the picture resource is updated, you need to rename the file name, so that you can reload the new picture.

Here is the path to set the cache image. The above are three methods.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>