java - 使用android加速远程数据检索

标签 java android sql

好吧,我正在为大学做这个项目,并且正在努力想办法优化我的co以使其运行得更快。

首先,我通过连接到 facebook 来获取用户的数组列表,这根本不需要很长时间。然而,对于每个用户,我需要获取存储在远程 MySQL 数据库上的数据。因此,要执行此操作,我使用以下方法...

// gets arraylist of users
ArrayList<User> userList= getList();
// ok so for the next bit, for each user in the arraylist i get their data on the   
database.
  for (User u: userList){
    u.setResultList(retireveData(u));
    if (u.getResultList()!=null){
        //do some magic :)
    }
  }

好吧,就是这样...我的想法是,第一次需要很长时间,是的,但是然后我可以将数据存储在本地 sqlite 数据库上,这样它将来运行得更快,并且仅在添加新数据时才更新它。有什么建议吗?

最佳答案

嗯...我认为你需要一个 CursorAdapter。

它会随着新数据的到来而更新您的 View 。 请参阅此链接 - http://thinkandroid.wordpress.com/2010/01/13/custom-baseadapters/

关于java - 使用android加速远程数据检索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11719167/

相关文章:

java - Spring 社交 Facebook 登录

java - 如何在 goDaddy 托管上使用 Java 代码编译文件并将其上传到我的域

android - https 获取服务器证书

Android p2p0接口(interface)有ipv6地址

java - 如何在 MongoDB Java 驱动程序 3 中插入​​文档

java - org.springframework.web.HttpMediaTypeNotSupportedException : Content type 'application/xml;charset=UTF-8' not supported

android - 将方形图像裁剪为圆形 - 以编程方式

SQL ON DELETE CASCADE,删除是通过哪种方式发生的?

mysql - 组函数MySql的无效使用

mysql - 如何从 MySQL 中的分组数据中删除行