[英]Can i parse JSON on the main thread if I have the file locally
I need to know whether I will be able to read (parse) a big (1500-2500 lines) JSON if i have it in the device for offline usage and do it on the main thread? 我需要知道如果我将其存储在设备中以供离线使用并在主线程上进行操作,是否能够读取(解析)大(1500-2500行)JSON? I think it shouldnt be a problem but its only a suggestion.
我认为这不应该是一个问题,但这只是一个建议。
You can, but I wouldn't recommend it. 您可以,但我不建议您这样做。 It'll result in a pause that isn't ideal.
这将导致不理想的暂停。 It's not hard to offload that to an
AsyncTask
or some other means of moving it away from the main thread. 将其卸载到
AsyncTask
或其他将其从主线程中移出的方法并不难。
是的,可以,但是如果您执行的是大型任务,则它可能会冻结UI(取决于您要解析的生命周期状态),但作为kabuko用户,建议您在AsyncTask
或AsyncTaskLoader
启动另一个线程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.