Attempt to invoke virtual method on a null object reference AsyncTask fragment

0

I've been in this for several days and I still do not understand why this error, I have an AsyncTask that pulls Urls from a database / p>

I want to get the url and set the imageView

gives an error on this line imageviewArray[n].setImageBitmap(loadedImage);

int n;

public void onActivityCreated(Bundle bundle) {
  super.onActivityCreated(bundle);


    imageViewArray[0] = (ImageView) getView().findViewById(R.id.quick_profile_0);
    imageViewArray[1] = (ImageView) getView().findViewById(R.id.quick_profile_1);
    imageViewArray[2] = (ImageView) getView().findViewById(R.id.quick_profile_2);
    imageViewArray[3] = (ImageView) getView().findViewById(R.id.quick_profile_3);
    imageViewArray[4] = (ImageView) getView().findViewById(R.id.quick_profile_4);
    imageViewArray[5] = (ImageView) getView().findViewById(R.id.quick_profile_5);
    imageViewArray[6] = (ImageView) getView().findViewById(R.id.quick_profile_6);
    imageViewArray[7] = (ImageView) getView().findViewById(R.id.quick_profile_7);
    imageViewArray[8] = (ImageView) getView().findViewById(R.id.quick_profile_8);
    imageViewArray[9] = (ImageView) getView().findViewById(R.id.quick_profile_9);
    imageViewArray[10] = (ImageView) getView().findViewById(R.id.quick_profile_10);

    imageView = (ImageView) getView().findViewById(R.id.test);

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()).build();
    ImageLoader.getInstance().init(config);
}

public void test(String g, int i) {

    n = i;
    ImageLoader imageLoader = ImageLoader.getInstance();

                     // g = src url
    imageLoader.loadImage(g, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage){

          // Error - ImageView = null
          imageViewArray[n].setImageBitmap(loadedImage);

        }
    });
}


//onPostExecute do Asynctask

protected void onPostExecute(String a) {
    super.onPostExecute(a);

    test(a, 1);
    //a = www.exemple.com/photo/photo.png
}
    
asked by anonymous 19.10.2015 / 22:53

0 answers