【问题标题】:where to implement network operation in android service or in background thread?在android服务或后台线程中在哪里实现网络操作?
【发布时间】:2014-09-21 03:37:53
【问题描述】:

在我的 android 应用程序中有很长的网络操作待办事项。 1.将所有网络运营转移到服务上是一种好习惯吗? 2.如果我需要将数据加载/存储到文件系统,在哪里可以做到这一点?主线程? 后台线程在服务中?还是主线程下的后台线程?

谢谢。

【问题讨论】:

    标签: android networking service local-storage background-process


    【解决方案1】:
    1. 有关网络操作,请查看Volley library

    2. 要将数据存储到文件系统,请使用Content Provider

    切勿在主线程中执行阻塞操作(如大型数据库操作)(导致“应用程序无响应” - ANR 消息)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-17
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多