createBitmap method of Bitmap class returns an error
<p>I have a problem that I am writing the code of scaling the bitmap and create new Bitmap usint Bitmap.createBitmap() method that returns always an error which can't be recognized by me. Please suggest me any solution regarding the same.</p>

<p><strong>ErrorStack:</strong></p>

<pre><code>02-22 16:27:14.679: E/AndroidRuntime(10363): FATAL EXCEPTION: main
02-22 16:27:14.679: E/AndroidRuntime(10363): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.TestFace.FaceDetect/com.TestFace.FaceDetect.ProcessImage}: java.lang.IllegalArgumentException: width and height must be &gt; 0
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.os.Looper.loop(Looper.java:123)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread.main(ActivityThread.java:4627)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at java.lang.reflect.Method.invokeNative(Native Method)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at java.lang.reflect.Method.invoke(Method.java:521)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at dalvik.system.NativeStart.main(Native Method)
02-22 16:27:14.679: E/AndroidRuntime(10363): Caused by: java.lang.IllegalArgumentException: width and height must be &gt; 0
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.graphics.Bitmap.nativeCreate(Native Method)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at com.TestFace.FaceDetect.ProcessImage.scaleImage(ProcessImage.java:247)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at com.TestFace.FaceDetect.ProcessImage.onCreate(ProcessImage.java:67)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-22 16:27:14.679: E/AndroidRuntime(10363):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-22 16:27:14.679: E/AndroidRuntime(10363):    ... 11 more
</code></pre>

<p><strong>Code:</strong></p>

<pre><code> private Bitmap scaleImage(Bitmap paramBitmap) {
        // TODO Auto-generated method stub
         int i = paramBitmap.getWidth();
         System.out.println("Width========="+i);
            int j = paramBitmap.getHeight();
            System.out.println("Height========="+j);
            float f2 = j / i * 300;
            float f1 = 300 / i;
            f2 /= j;
            Matrix localMatrix = new Matrix();
            localMatrix.postScale(f1, f2);
            return Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, false);
    }
</code></pre>
