title: How to handle java.io.FileNotFoundException while loading images from webservice in android
body: <p>i have issues  java.io.FileNotFoundException error in my application , in my aplication am using <a href="https://github.com/nostra13/Android-Universal-Image-Loader/downloads" rel="nofollow">Android-Universal-Image-Loader</a>,for loading images form web service, i know Filenotfound exceprion means that url is not valid,  i need to hanlde this excepton can any one help me , how to handle this error.</p>
  
  <pre><code>public class TestApp extends Application {
      // private static final String TAG = TFEApplication.class.getSimpleName();
  
      @Override
      public void onCreate() {
          super.onCreate();
  
          ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                  getApplicationContext())
                  .threadPriority(Thread.NORM_PRIORITY - 2)
                  .denyCacheImageMultipleSizesInMemory()
                  .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
                  .tasksProcessingOrder(QueueProcessingType.FIFO).build();
  
          // Initialize ImageLoader with configuration.
          ImageLoader.getInstance().init(config);
      }
  }
  public class MainActivity extends Activity {
      private ImageLoader mImageLoader;
      private DisplayImageOptions mDisplayImageoptions;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mDisplayImageoptions = new DisplayImageOptions.Builder()
                  .showImageOnLoading(R.drawable.ic_launcher).cacheInMemory(true)
                  .cacheOnDisc(true).considerExifParams(true).build();
          mImageLoader = ImageLoader.getInstance();
          setContentView(R.layout.activity_main);
  
      }
  
      @Override
      protected void onStart() {
  
          super.onStart();
  
          try{
          ImageView testView =(ImageView) findViewById(R.id.imageid);
          mImageLoader.displayImage("http://examle.com",testView, mDisplayImageoptions);
          }catch(Exception execException)
          {
              System.out.println(execException.getMessage());
          }
      }
  
  }
  </code></pre>
  
  <p>Error am getting :</p>
  
  <pre><code>java.io.FileNotFoundException: http://exame.com/text.jpg
  at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
   com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromNetwork(BaseImageDownloader.java:111)
      at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:77)
      at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:319)
      at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisc(LoadAndDisplayImageTask.java:298)
      at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:241)
      at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:141)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
      at java.lang.Thread.run(Thread.java:841)
  </code></pre>