简体   繁体   English

使用 Android 进行移动应用程序开发

[英]Mobile Application Development using Android

I am developing an android application in which when a user logins through facebook his profile picture gets stored.我正在开发一个android 应用程序,当用户通过 facebook 登录时,他的个人资料图片会被存储。 Then the user is shown the profile pictures of his fb friends who have installed the app, one by one.然后用户会看到他安装了该应用程序的fb好友的头像,一张一张。 First, one friend's pic is shown then on click of next button, next friend's pic is shown.首先,显示一个朋友的照片,然后单击下一个按钮,显示下一个朋友的照片。 This continues till all the friends images have been shown to the user or user has skipped the section.这一直持续到所有朋友图像都已显示给用户或用户已跳过该部分。

First, I thought of storing all the images in my database and then retrieve them one by one as the user presses the next button.首先,我想将所有图像存储在我的数据库中,然后在用户按下下一步按钮时将它们一一检索。 But doing so will render very slow performance as for every time an image has to be shown to the user I have to hit the db.但是这样做会导致性能非常慢,因为每次必须向用户显示图像时,我都必须点击数据库。

The alternative is to store images in my local drive and store every image's location in the db.另一种方法是将图像存储在我的本地驱动器中,并将每个图像的位置存储在数据库中。

Please elaborate on how this could be achieved and the performance issues in this case considering a large user base?请详细说明如何实现这一点以及考虑到庞大的用户群在这种情况下的性能问题? Also suggest any other way of achieving the aim, if you may.如果可以,还建议任何其他实现目标的方式。

I am using WAMP for the purpose.我为此目的使用 WAMP。

Thanks in advance.提前致谢。

The pictures are stored in the apps cache after they are downloaded.图片在下载后存储在应用程序缓存中。

When the user logs in to fb for the 1st time it will download the images.当用户第一次登录 fb 时,它将下载图像。

2nd time it will get them from cache unless its a new image.第二次它将从缓存中获取它们,除非它是一个新图像。

clear the cache when it gets to a certain MB limit and keep it small当达到一定的 MB 限制时清除缓存并保持较小

I suggest using Google Volley library to get images from the net as when setup properly you can expire / clear images from the cache.我建议使用 Google Volley 库从网络获取图像,因为正确设置后您可以从缓存中过期/清除图像。

The are are other libraries for image loading and handling to consider such as Universal Image loader and Picasso but Volley can also be used for fetching Data from the Net.还有其他需要考虑的图像加载和处理库,例如通用图像加载器和毕加索,但 Volley 也可用于从网络获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM