title: Download Images From URL to SD Card
body: <p>I am trying  to create a very simple Image Downloading app. in which i want to download all images from this url to sd card: <code>https://www.dropbox.com/sh/5be3kgehyg8uzh2/AAA-jYcy_21nLBwnZQ3TBFAea</code></p>
  
  <p><strong>this code works to load image in imageview:</strong></p>
  
  <pre><code>package com.example.imagedownloadsample;
  
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.widget.ImageView;
  
  import com.squareup.picasso.Picasso;
  
  public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.image_download);
  
          final ImageView img = (ImageView) (findViewById(R.id.imageView1));
  
          // File file = new File(Environment.getExternalStorageDirectory(),
          // "Android/data/com.usd.pop");
  
          Picasso.with(getApplicationContext())
                  .load("http://8020.photos.jpgmag.com/3456318_294166_528c960558_m.jpg")
                  .into(img);
  
      }
  
  }
  </code></pre>
  
  <p><strong>but when i tried like this to download image to sd card i end-up with unfortunatelly app stopped error:</strong></p>
  
  <pre><code>package com.example.imagedownloadsample;
  
  import java.io.File;
  
  import android.os.Bundle;
  import android.os.Environment;
  import android.support.v7.app.ActionBarActivity;
  
  import com.squareup.picasso.Picasso;
  import com.squareup.picasso.Target;
  
  public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.image_download);
  
          //final ImageView img = (ImageView) (findViewById(R.id.imageView1));
  
           File file = new File(Environment.getExternalStorageDirectory(),
           "Android/data/com.usd.pop");
  
          Picasso.with(getApplicationContext())
                  .load("http://8020.photos.jpgmag.com/3456318_294166_528c960558_m.jpg")
                  .into((Target) file);
  
      }
  
  }
  </code></pre>