使用扩展应用程序的全局变量设置 Vollery ImgController

Setting Vollery ImgController with global variables extending application

我正在尝试使用 volley 从下一行 url 加载图像:

Image.setImageUrl(url, ImgController.getInstance().getImageLoader());

但是无法解析ImgController。我检查并发现我需要在 AndroidManifest.xml 文件中注册我的自定义应用程序上下文,使用以下行:

<application android:name="ImgController" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name">

但我已经在使用与我的全局变量(class 扩展应用程序)不同的上下文,如下所示:

<application android:name_"example.example.name.Global" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name">

所以这是我的问题,如何在不篡改全局变量的情况下设置 ImgController class?

谢谢。

最终使用了 Volley ImageRequest,效果很好。 这是代码:

public void fetchBackgroundImage(String url){
    ImageRequest imgRequest = new ImageRequest(url,
            new Response.Listener<Bitmap>() {
                @Override
                public void onResponse(Bitmap bitmap) {
                    Drawable banner = new BitmapDrawable(bitmap);
                    findViewById(R.id.headerImage).setBackgroundDrawable(banner);
                }
            },256,88,null,
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError ex) {
                     System.out.println(ex.getMessage().toString());
                }
            }
    );
    RequestQueue rq = Volley.newRequestQueue(this);
    rq.add(imgRequest);
}