title: How resize image from file?
body: <p>Im trying change size of images in my folder. I wrote this:</p>
  
  <pre><code>FileOutputStream fos = new FileOutputStream(fullPath);
  BitmapFactory.Options optsorg = new BitmapFactory.Options();
  optsorg.inSampleSize = 2;
  Bitmap bitmaporg = BitmapFactory.decodeFile(fullPath, optsorg);
  bitmaporg = Bitmap.createScaledBitmap(bitmaporg, 600, 400, true);
  bitmaporg.compress(Bitmap.CompressFormat.JPEG, 100, fos);
  fos.close();
  </code></pre>
  
  <p>But it gives error. Where is my error?
  LogCat:</p>
  
  <pre><code>06-10 22:10:35.469: E/AndroidRuntime(22785): FATAL EXCEPTION: main
  06-10 22:10:35.469: E/AndroidRuntime(22785): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {com.example.camerademo/com.example.camerademo.Main}: java.lang.NullPointerException
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3205)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3248)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread.access$1200(ActivityThread.java:140)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1285)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.os.Handler.dispatchMessage(Handler.java:99)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.os.Looper.loop(Looper.java:137)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread.main(ActivityThread.java:4921)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at java.lang.reflect.Method.invokeNative(Native Method)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at java.lang.reflect.Method.invoke(Method.java:511)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at dalvik.system.NativeStart.main(Native Method)
  06-10 22:10:35.469: E/AndroidRuntime(22785): Caused by: java.lang.NullPointerException
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:461)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at com.example.camerademo.Main.onActivityResult(Main.java:73)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.Activity.dispatchActivityResult(Activity.java:5372)
  06-10 22:10:35.469: E/AndroidRuntime(22785):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3201)
  </code></pre>