决定Android应用程序的内部和外部图像存储选项? [英] Decide between internal and external image storage options for android app?

查看:149
本文介绍了决定Android应用程序的内部和外部图像存储选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在什么时候,就想要在应用中显示的图像的数量和大小而言,是否更好地从网站提供图像而不是将它们本地存储在应用程序中?



我是漫画家,正在学习java和android开发,所以我可以创建一个显示我的漫画的应用程序,这是动画GIF文件。该应用程序的第一个版本将显示大约100个GIF,每个大小约为50K。我希望GIF系列能够增长到1000.我看到Google上的其他应用程序显示图像文件并且它们只有5MB,这让我觉得我不应该尝试在我的应用程序中本地存储图像。但我担心让它们尽可能快地加载。



我发现了很多有用的代码示例,用于在Android应用程序中使用android.graphics.movi​​e显示动画GIF和WebView,显示如何从Web实现本地存储或加载。但是我无法找到任何建议,根据所涉及的图像的数量和大小,最好选择本地而不是外部或其他方式。



感谢您提供任何帮助!

At what point, in terms of the quantity and size of images that you want to display in an app, is it better to serve images from a Web site than to store them locally in the app?

I am cartoonist who is learning java and android development so I can create an app that displays my cartoons, which are animated GIF files. The first version of the app will display about 100 GIFs, each about 50K in size. I expect the GIF collection to grow to 1000. I see other apps on Google play display image files and they are only 5MB, which makes me think that I should not try to store images locally in my app. But I am concerned about having them load as fast as possible.

I have found many useful code examples for displaying animated gifs in an android app using android.graphics.movie and WebView that show how to implement local storage or load from the Web. But I have not been able to find any recommendations about when, depending on the number and size of images involved, it is better to choose local over external or the other way around.

Thank you for any help you can offer!

推荐答案

如果您使用本地存储,即保存在设备上的图像,那么每次发布更多漫画你将不得不推出一个新版本的应用程序。此外,应用程序可能会变得太大,甚至不适合某些旧设备。



我的建议是使用网络/云存储和批量预取图像。例如,一次获得10个图像,然后当用户观看图像#6获得另一个批次时,当用户到达图像#10时,另一个批次将准备好显示,并且对于用户来说,似乎图像是永远在那里。为此,您需要在后台进程中下载图像。换句话说,让你的图像下载程序在一个单独的线程上运行,这样它就不会影响UI。此外,可能会在本地存储您最好的漫画,然后当用户查看那些从网络/云下载其他图像
If you go with local storage, i.e. images saved on the device itself then every time you release more cartoons you will have to roll out a new version of the app. Also the app may become too big and not even fit on some older devices.

My advice is go with web/cloud storage and pre-fetch images in batches. For example get 10 images at a time, then when a user views image #6 get another batch, that way by the time user gets to image #10 another batch will be ready to display and it will seems to the user like the images were always there. In order to do this you will nee to download the images in a background process. In other words let your image downloader run on a separate thread so that it does not impact the UI. Additionally maybe store your best cartoons locally and then while users are viewing those download additional images from the web/cloud


可能你正在谈论Android设备的闪存片;通常,一个焊接在机器内部,另一个可以插入槽中。如果你的意思是别的,请纠正我。



想象一下,用户就是你。如果您强制用户使用内部,则此人可能需要尽快将图像保存在其他位置。不幸的是,Android中典型的工作方式面向那些几乎不了解文件系统文件位置的用户,许多人甚至不了解文件的概念,他们只是点击图像,等等。定位文件并通过网络从卡到卡传输对许多人来说都很尴尬,但有些只是有更大的外部存储空间。



所以,这是否意味着答案是:外部存储?没有。用户没有? Android设备通常在没有外部卡的情况下销售。



因此,结论是:不要做出这个选择,留给用户。给用户一个明确的选择。



-SA
Probably you are talking about the piece of flash memory of an android device; usually, one is soldered inside the machine, and another one can be inserted in the slot. If you mean something else, please correct me.

Imagine the user is you. If you force the user to use the internal, this person may face the need to save your images elsewhere soon enough. And unfortunately, the typical style of work in Android is oriented to the users who hardly understand where in the file system the files are, many don't even understand the concept of files, they just click on images, and so on. Locating the file and transmitting them over network of from card to card would be awkward for many, but some just have a bigger external storage.

So, does it mean that the answer is: external storage? No. How about the user not having any? The Android device is typically sold without external card.

So, the conclusion is: don't make this choice at all, leave it to the user. Give the user a clear choice.

—SA


这篇关于决定Android应用程序的内部和外部图像存储选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆