Android Camera pick image and upload
<p>I have written code to capture photo and upload the captured image to the Facebook.It worked great for all the devices but when i try to run the app on Samsung galaxy s3,the app got crashed and given outofmemory error and when i compressed the image it showing Null-pointer exception.</p>

<pre><code>        Intent intent = new Intent(
                MediaStore.ACTION_IMAGE_CAPTURE);
         this.file = new File(
                Environment
                        .getExternalStorageDirectory(),
                "tmp_"
                        + String.valueOf(System
                                .currentTimeMillis())
                        + ".jpg");
        ImageCaptureUri = Uri.fromFile(file);

        try {
            intent.putExtra(
                    android.provider.MediaStore.EXTRA_OUTPUT,
                    ImageCaptureUri);
            intent.putExtra("return-data", true);

            startActivityForResult(intent,
                    PICK_FROM_CAMERA);
        } catch (Exception e) {
            e.printStackTrace();
</code></pre>

<h2>            }</h2>

<p>::onActivityResult</p>

<pre><code>uploadBitmap= decodeFile(MainActivity.this.file);



                         int width = uploadBitmap.getWidth()/3;
                         int height = uploadBitmap.getHeight()/3;


                 //     uploadBitmap=Bitmap.createScaledBitmap(uploadBitmap, 50, 50, false);

                        ByteArrayOutputStream stream = new ByteArrayOutputStream();
                        uploadBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);





                        byte[] byteArray = stream.toByteArray();

                        // Bitmap bitmap = BitmapFactory.decodeFile(path);

                        if (photoUrl != null) {
                            Bundle params = new Bundle();

                            params.putByteArray("photo", byteArray);

                            params.putString("caption",
                                    MainActivity.locationData+" lat: "+MainActivity.latitude+" long:"+MainActivity.longitude);

                            String place ="\"location\""+": {"+
                                   "\"latitude\""+":"+"\"12.9833\""+","+
                                   "\"longitude\""+":"+"\"77.5833\""+
                                "}";


                            params.putString("place", placeid);

                            Utility.mAsyncRunner.request("me/photos", params, "POST",
                                    new PhotoUploadListener(), null);
                        } else {
                            Toast.makeText(getApplicationContext(),
                                    "Error capturing image",
                                    Toast.LENGTH_SHORT).show();
                        }
</code></pre>
