Adding watermarks to photos
<p>Oh,my first question~<br>
Here is my problem.I'm making an Application to take photos and add a watermark to it.<br>
First step,as the application launches,I take a shot(use the biggest resolution,like2592*1952(5M)).After the photo is taken,and I press Ok to return to my application's view,the application crashes.<br>
But,if I take a shot as the app launches with the resolution not that big(like 3M,2M,1M),it works all right.And then,the second shot,with the resolution of 5M,it works fun either way.
I'm puzzled.Can anyone help me?
Here is some code about decoding the image file.</p>

<pre><code>    public void onClick(View v){
                Bitmap bitmap1 =mcreateBitmap(bitmaptmp, "watermark");
//              bitmaptmp=null;
                /* Associate the Bitmap to the ImageView */
                if (bitmap1 != null) {
                    mImageView.setImageBitmap(bitmap1);                 
                }
                mImageView.setVisibility(View.VISIBLE);
//              try {
//                  String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
//                  String imageFileName = JPEG_FILE_PREFIX + timeStamp;
//                  saveMyBitmap(imageFileName,bitmap1);
//                  bitmap1=null;
//              } catch (IOException e) {
//                  e.printStackTrace();
//              }   
            }
</code></pre>

<p>public Bitmap mcreateBitmap(Bitmap src, String str) {</p>

<pre><code>    Time t = new Time();
    t.setToNow();       
    int w = src.getWidth();
    int h = src.getHeight();

    String mstrTitle = "11："+t.hour + ":" + t.minute + ":" + t.second;
    String xx="34："+x;
    String yy="44："+y;      
    Bitmap bmpTemp = Bitmap.createBitmap(w, h, Config.ARGB_8888);

    Canvas canvas = new Canvas(bmpTemp);
    Paint photoPaint = new Paint(); 
    photoPaint.setDither(true);   
    photoPaint.setFilterBitmap(true);
    Rect s = new Rect(0, 0, src.getWidth(), src.getHeight());
    Rect d = new Rect(0, 0, w, h);
    canvas.drawBitmap(src, s, d, photoPaint);

    String familyName = "new";
    Typeface font = Typeface.create(familyName, Typeface.BOLD);
    photoPaint.setColor(Color.BLUE);
    photoPaint.setTypeface(font);
    photoPaint.setTextSize(18); 
    canvas.drawText(mstrTitle,40, 20, photoPaint);
    canvas.drawText(xx,40, 40, photoPaint);
    canvas.drawText(yy,40, 60, photoPaint);
    canvas.save(Canvas.ALL_SAVE_FLAG);
    canvas.restore();

    return bmpTemp;
}
</code></pre>

<p>Here is logCat:<br>
01-05 11:25:25.791: E/dalvikvm-heap(11147): 20238336-byte external allocation too large for this process.
01-05 11:25:25.791: E/dalvikvm(11147): Out of memory: Heap Size=2923KB, Allocated=2460KB, Bitmap Size=1235KB, Limit=13756KB
01-05 11:25:25.791: E/dalvikvm(11147): Trim info: Footprint=2883KB, Allowed Footprint=3267KB, Trimmed=344KB
01-05 11:25:25.791: E/GraphicsJNI(11147): VM won't let us allocate 20238336 bytes
01-05 11:25:25.801: D/AndroidRuntime(11147): Shutting down VM
01-05 11:25:25.801: W/dalvikvm(11147): threadid=1: thread exiting with uncaught exception (group=0x40028a00)
01-05 11:25:25.801: E/AndroidRuntime(11147): FATAL EXCEPTION: main
01-05 11:25:25.801: E/AndroidRuntime(11147): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
01-05 11:25:25.801: E/AndroidRuntime(11147):    at android.graphics.Bitmap.nativeCreate(Native Method)
01-05 11:25:25.801: E/AndroidRuntime(11147):    at android.graphics.Bitmap.createBitmap(Bitmap.java:574)
01-05 11:25:25.801: E/AndroidRuntime(11147):    at com.kevin.photowatermark.PhotowatermarkActivity.mcreateBitmap(PhotowatermarkActivity.java:403)</p>
