@@ -0,0 +1,2656 @@
+import android.content.Intent;%0Aimport android.graphics.Bitmap;%0Aimport android.net.Uri;%0Aimport android.provider.MediaStore;%0Aimport android.support.v7.app.ActionBarActivity;%0Aimport android.os.Bundle;%0Aimport android.view.View;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0A%0Apublic class MainActivity extends ActionBarActivity %7B%0A    private static final int REQUEST_CHOOSE_IMAGE = 1;%0A    private static final int COMPRESSION_QUALITY = 50; //Value between 0 and 100 (inclusive)%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.activity_main);%0A    %7D%0A%0A    public void downloadImage(View view) %7B%0A        ImageDownloader downloader = new ImageDownloader();%0A        downloader.execute(%22Link to a remote image%22);%0A    %7D%0A%0A    public void openGallery(View view) %7B%0A        Intent intent = new Intent();%0A        intent.setType(%22image/*%22);%0A        intent.setAction(Intent.ACTION_GET_CONTENT);%0A        startActivityForResult(Intent.createChooser(intent, %22Select Picture%22), REQUEST_CHOOSE_IMAGE);%0A    %7D%0A%0A    @Override%0A    protected void onActivityResult(int requestCode, int resultCode, Intent data) %7B%0A        super.onActivityResult(requestCode, resultCode, data);%0A        if(requestCode == REQUEST_CHOOSE_IMAGE && data != null && data.getData() != null) %7B%0A            startImageUpload(data.getData());%0A        %7D%0A    %7D%0A%0A    private void startImageUpload(Uri imageUri) %7B%0A        try %7B%0A            File f = new File(getCacheDir(), %22image.jpeg%22);%0A            f.createNewFile();%0A%0A            Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);%0A%0A            ByteArrayOutputStream bos = new ByteArrayOutputStream();%0A            bitmap.compress(Bitmap.CompressFormat.JPEG, COMPRESSION_QUALITY, bos);%0A            byte%5B%5D bitmapdata = bos.toByteArray();%0A%0A            FileOutputStream fos = new FileOutputStream(f);%0A            fos.write(bitmapdata);%0A            fos.flush();%0A            fos.close();%0A%0A            /**%0A             * Create an AsyncTask to upload the image chosen in the image gallery.%0A             * The bitmap doesn't have to come from the gallery, just change%0A             * Bitmap 'bitmap' to the image you would like to upload.%0A             * Upon success, the ImgurUploader task prints the image's link on Imgur,%0A             * and can easily be modified to use this link throughout the app.%0A             */%0A            ImgurUploader uploader = new ImgurUploader();%0A            uploader.execute(f);%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

Create MainActivity.java