我有一个 Activity 和一个 intentService,我的 intentServie 从 Web 获取一些数据并需要将其传回 Activity 。我目前在服务中使用 ResultReceiver 将数据传回 Activity 。
Is it appropriate for larg data set ?
Do Intents have any limit on the data passed through putExtra ?
How should I update UI (ListView) on main activity ? (won't it be hanged on large dataSet ?
Should I use contentProvider instead ? If yes , how would I query large dataset in UI thread (without causing ANR)?
谢谢。
最佳答案
- 不,不适合通过Intent发送大数据
- 据我所知,有一次我试图发送上面的字节数据 1MB,它无法做到这一点。所以我相信,它确实有数据 限制
- 因为您正在使用 ResultReceiver,所以最好使用它 onReceiveResult 以获取结果通知并在您的用户界面中进行任何必要的更新
- 如果您的应用不向其他应用提供数据,那么我猜它也是 大惊小怪
关于android - 将数据返回到 Activity 、intent.putExtra 或 contentprovider?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10222553/