title: Download pictures from amazon S3
body: <p>I tried to display the image from my amazon s3 buckets to web browser. But the result gave me an error <strong>"The specified key doesnt exist"</strong>. The file is exist inside buckets.</p>
  
  <p>Here is my codes</p>
  
  <pre><code>public class TempActivity extends Activity {
      ImageView ivTemp;
      String key;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_temporary);
  
          ivTemp = (ImageView) findViewById(R.id.imgTemporary);
  
          AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(Constants.amazonAccessKeyID,
                  Constants.amazonSecretAccessKey));
  
          key = "HJiDw6GkuS7gl82N4lCw.jpg";
  
          ResponseHeaderOverrides overrides = new ResponseHeaderOverrides();
          overrides.setContentType("image/jpeg");
          GeneratePresignedUrlRequest urlRequest = new GeneratePresignedUrlRequest(Constants.amazonS3BucketName,key);
          urlRequest.setExpiration(new Date(System.currentTimeMillis() + 3600000));
          urlRequest.setResponseHeaders(overrides);
          URL url = s3Client.generatePresignedUrl(urlRequest);
          try {
              startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url.toURI().toString())));
          } catch (URISyntaxException e) {
              e.printStackTrace();
          }
  
  
      }
  }
  </code></pre>
  
  <p>I've tried to do like:</p>
  
  <ol>
  <li><a href="http://aws.amazon.com/articles/SDKs/Android/3002109349624271" rel="nofollow">http://aws.amazon.com/articles/SDKs/Android/3002109349624271</a></li>
  <li><a href="http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/s3transferutility.html" rel="nofollow">http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/s3transferutility.html</a></li>
  <li><a href="http://www.programcreek.com/java-api-examples/index.php?api=com.amazonaws.services.s3.model.GeneratePresignedUrlRequest" rel="nofollow">http://www.programcreek.com/java-api-examples/index.php?api=com.amazonaws.services.s3.model.GeneratePresignedUrlRequest</a></li>
  </ol>
  
  <p>What I want to do is I want to download images from my bucket on AWS.
  Please advise.
  Thank you</p>