title: java.net.malformedurlexception protocol not found
body: <p>I am using following code and it keeps giving me malformedurlexception error. The funny part is I have copied it from another project which the same code is working properly. I was wondering if anyone can see what the problem might be. The section of code which is giving the error is in OpenHttpConnection function and at start where it says:</p>
  
  <pre><code>URL url = new URL(urlString); 
  URLConnection conn = url.openConnection();
  </code></pre>
  
  <p>I appreciate any help I can get.</p>
  
  <pre><code>Bitmap bitmapOrg = null;
  bitmapOrg = DownloadImage("http://www.bagherpour.com/apache_pb.gif");
  
  public Bitmap DownloadImage(String txt)
  {    
  
      Bitmap bitmap = null;
      InputStream in = null;   
      try {           
          in = OpenHttpConnection(txt);
          bitmap = BitmapFactory.decodeStream(in);
  
          in.close();
          return bitmap;     
      } catch (IOException e1) {
          e1.printStackTrace();
          Log.d("bitMap",e1.toString());
          return null;
      }                
  }
  
  public InputStream OpenHttpConnection(String urlString) 
      throws IOException
          {
              InputStream in = null;
              int response = -1;
  
              URL url = new URL(urlString); 
              URLConnection conn = url.openConnection();
  
              if (!(conn instanceof HttpURLConnection))                     
                  throw new IOException("Not an HTTP connection");
  
              try{
                  HttpURLConnection httpConn = (HttpURLConnection) conn;
                  httpConn.setAllowUserInteraction(false);
                  httpConn.setInstanceFollowRedirects(true);
                  httpConn.setRequestMethod("GET");
                  httpConn.connect(); 
  
                  response = httpConn.getResponseCode();                 
                  if (response == HttpURLConnection.HTTP_OK) {
                      in = httpConn.getInputStream();                                 
                  }                     
              }
              catch (Exception ex)
              {
                  throw new IOException("Error connecting");            
              }
              return in;     
  </code></pre>