当前位置: 东星资源网 > 作文大全 > 高中作文 > 正文

volley 内存溢出【volley内存溢出的问题所在】

时间:2018-08-14 来源:东星资源网 本文已影响 手机版

  在网络请求中有网络溢出现象,可能大家很少见到过这种情况,可为了解决这问题。为此小编为大家整理推荐了,希望大家喜欢。

  volley内存溢出

  官网上有写,然后创建RequestQueue 的时候用Application的context。If your application makes constant use of the network, it's probably most efficient to set up a single instance of RequestQueue that will last the lifetime of your app. You can achieve this in various ways. The recommended approach is to implement a singleton class that encapsulates RequestQueue and other Volley functionality. Another approach is to subclass Application and set up the RequestQueue in Application.onCreate(). But this approach is discouraged; a static singleton can provide the same functionality in a more modular way.

  A key concept is that the RequestQueue must be instantiated with the Application context, not an Activity context. This ensures that the RequestQueue will last for the lifetime of your app, instead of being recreated every time the activity is recreated (for example, when the user rotates the device).

  图一:

  图二:

标签: volley内存溢出的问题所在 weka内存溢出问题 tomcat内存溢出