且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的NullPointerException异常CipherInputStream为位图

更新时间:2023-11-16 16:04:46

您需要一个onCreate()方法。

You need an onCreate() method.

  @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        AssetManager am = getAssets();//this should not get a nullpointerexception
  }

或执行以下操作:

在您的活动(哪一个调用图像加载器)这样写:

In your Activity (whichever one calls image loader) write this:

ImageLoader il = new ImageLoader(this);//this being the context.

然后在你的类ImageLoader的可以使用

Then in your ImageLoader class you can use

AssetManager am = context.getAssets();//context being the activity which called this class.