title: Get profile picture from Facebook Graph-API
body: <p>this method to retrieve the photo facebook profile does not work anymore</p>
  
  <pre><code>ImageView user_picture;
   userpicture=(ImageView)findViewById(R.id.userpicture);
   URL img_value = null;
   img_value = new URL("http://graph.facebook.com/"+id+"/picture?type=large");
   Bitmap mIcon1 = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
  userpicture.setImageBitmap(mIcon1);
  </code></pre>
  
  <p>mIcon1 is null </p>
  
  <p>it functioned normally but not now and I think that facebook has changed something 
  when I check the URL that redirects to another url</p>
  
  <p>http: //graph.facebook.com/"id example(2154847)"/picture?type=large ---> https:// fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t1.0-  1/s200x200/1480603_10201506903424508_71775 13962104534241_n.jpg </p>
  
  <p><strong>Edit</strong> 
  solution :</p>
  
  <pre><code> public Bitmap getPhotoFacebook(final String id) {
  
      Bitmap bitmap=null;
      final String nomimg = "https://graph.facebook.com/"+id+"/picture?type=large";
      URL imageURL = null;
  
      try {
          imageURL = new URL(nomimg);
      } catch (MalformedURLException e) {
          e.printStackTrace();
      }
  
      try {
          HttpURLConnection connection = (HttpURLConnection) imageURL.openConnection();
          connection.setDoInput(true);
          connection.setInstanceFollowRedirects( true );
          connection.connect();
          InputStream inputStream = connection.getInputStream();
          //img_value.openConnection().setInstanceFollowRedirects(true).getInputStream()
          bitmap = BitmapFactory.decodeStream(inputStream);
  
      } catch (IOException e) {
  
          e.printStackTrace();
      }
      return bitmap;
  
  }
  </code></pre>