I have a bunch of fragments in a FragmentPagerAdapter with one ImageView in side each fragment. If I swipe really fast this error comes up:

```
E/AndroidRuntime: FATAL EXCEPTION: main
                Process: com.wilsapp.wilsapp, PID: 21319
                java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
                at com.wilsapp.wilsapp.Fragments.BuyerHomePageFragment9$DownloadImageTask.onPostExecute(BuyerHomePageFragment9.java:212)
                at com.wilsapp.wilsapp.Fragments.BuyerHomePageFragment9$DownloadImageTask.onPostExecute(BuyerHomePageFragment9.java:192)
                at android.os.AsyncTask.finish(AsyncTask.java:651)
                at android.os.AsyncTask.-wrap1(AsyncTask.java)
                at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:148)
                at android.app.ActivityThread.main(ActivityThread.java:5417)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

```

If I swipe slowly then it works perfectly fine.

Android Code (code is the same for each fragment. Code in AsyncTask):

```
   protected void onPostExecute(Bitmap result) {
    try {
        ImageView img = (ImageView) getView().findViewById(R.id.ProductOneImageView);
        img.setImageBitmap(result);
    }catch (Exception e){
        ImageView img = (ImageView) getView().findViewById(R.id.ProductOneImageView);
        int id = getResources().getIdentifier("com.wilsapp.wilsapp:drawable/" + "error", null, null);
        img.setImageResource(id);
    }
}

```

Android onCreatView method:

```
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_buyer_home_page, container, false);

    return view;
}

```

> 
> how can i avoid the NullPointerException?
> 
> 
>