实践中发现,在Service中申请HashMap空间存在一些问题
public static List<ModelApp> dispList;
public static HashMap<String, Bitmap> bitmapMap;
public static List<Bitmap> bmpList;
bmpList = new ArrayList<Bitmap>();
bitmapMap = new HashMap<String, Bitmap>();
try {
if(dispList == null)
Log.e("Volley", "bitmap down" + "dispList is null");
if(bmpList != null)
Log.e("Volley", "bitmap down" + "--------------bmpList is not null");
if(bitmapMap == null)
Log.e("Volley", "bitmap down" + "bitmapMap is null");
} catch (Exception e) {
Log.e("Volley", "bitmap down" + e.toString());
}
运行结果如下:
08-28 14:03:19.395 10645-10645/com.mobi.ads E/Volley﹕ bitmap down————–bmpList is not null
08-28 14:03:19.395 10645-10645/com.mobi.ads E/Volley﹕ bitmap downbitmapMap is null
08-28 14:03:19.395 10645-10645/com.mobi.ads E/Volley﹕ bitmap downjava.lang.NullPointerException
08-28 14:03:19.405 10645-10645/com.mobi.ads E/Volley﹕ bitmap down————–bmpList is not null
08-28 14:03:19.405 10645-10645/com.mobi.ads E/Volley﹕ bitmap downbitmapMap is null
08-28 14:03:19.405 10645-10645/com.mobi.ads E/Volley﹕ bitmap downjava.lang.NullPointerException
分析是Service的特殊限制。