below is my code to make bitmap from network-jpeg-stream whose size
is 360*288
i don't know how to handle it ,
---------------------------------------------------------------------------------------------------------------
private void makeImage() {
try {
System.arraycopy(BA.toByteArray(), 0, temporaryBA, 0,
BA.length());
int tempBALength = BA.length();
if (BA.byteAt(startJpeg) == (byte) 0xff &&
BA.byteAt(startJpeg + 1)
== (byte) 0xD8) {
if ((BA.byteAt(endJpeg - 1) == (byte) 0xff &&
BA.byteAt(endJpeg)
== (byte) 0xD9)
|| (BA.byteAt(endJpeg - 2) ==
(byte) 0xff && BA.byteAt(endJpeg -
1) == (byte) 0xD9)) {
BitmapFactory.Options options = new
BitmapFactory.Options();
options.inSampleSize = 2;
options.inTempStorage = new byte[256];
Bitmap orgBitmap =
BitmapFactory.decodeByteArray(temporaryBA,
startJpeg, endJpeg - startJpeg +1,options);
Bitmap bitmap =
Bitmap.createScaledBitmap(orgBitmap, width,
(height / 2) , true);
if (bitmap != null) {
screenshot = new byte[endJpeg -
startJpeg +1];
System.arraycopy(temporaryBA,
startJpeg, screenshot, 0, endJpeg
- startJpeg +1);
Message msg =
Message.obtain(handler, 0, current_ch, 0, bitmap);
handler.sendMessage(msg);
} else {
BA.clear();
}
}else{
BA.clear();
}
}else {
BA.clear();
}
BA.clear();
BA.setLength(0);
BA.append(temporaryBA, iEndMarkIndex, tempBALength -
iEndMarkIndex);
} catch (IllegalArgumentException e) {
BA.clear();
} catch (OutOfMemoryError om) {
BA.clear();
} catch (NullPointerException np) {
BA.clear();
} catch (IndexOutOfBoundsException io) {
BA.clear();
}
}
---------------------------------------logcat -
error----------------------------------------------------
10-13 11:22:03.472: ERROR/dalvikvm-heap(6060): 384000-byte external
allocation too large for this process.
10-13 11:22:03.472: ERROR/dalvikvm(6060): Out of memory: Heap
Size=5639KB, Allocated=3134KB, Bitmap Size=18669KB
10-13 11:22:03.472: ERROR/(6060): VM won't let us allocate 384000
bytes
10-13 11:22:03.582: INFO/DEBUG(5641): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
10-13 11:22:03.582: INFO/DEBUG(5641): Build fingerprint: 'skt_kr/
htc_bravo/bravo/bravo:2.1-update1/ERE27/171460:user/release-keys'
10-13 11:22:03.582: INFO/DEBUG(5641): pid: 6060, tid: 6081 >>> rams
<<<
10-13 11:22:03.582: INFO/DEBUG(5641): signal 11 (SIGSEGV), fault addr
00000000
10-13 11:22:03.582: INFO/DEBUG(5641): r0 003d48d0 r1 00000000 r2
00000000 r3 003d48f4
10-13 11:22:03.582: INFO/DEBUG(5641): r4 003d48d0 r5 00000000 r6
00000000 r7 00000000
10-13 11:22:03.582: INFO/DEBUG(5641): r8 483b3d08 r9 42ea2ed4 10
483b3e38 fp 42ea2ed4
10-13 11:22:03.582: INFO/DEBUG(5641): ip 003d48d0 sp 483b3ae8 lr
00000000 pc ac04ab2c cpsr 60000010
10-13 11:22:03.612: INFO/DEBUG(5641): #00 pc 0004ab2c /
system/lib/libskia.so
10-13 11:22:03.612: INFO/DEBUG(5641): #01 pc 0004abf0 /
system/lib/libskia.so
10-13 11:22:03.612: INFO/DEBUG(5641): #02 pc 000689d4 /
system/lib/libskia.so
10-13 11:22:03.622: INFO/DEBUG(5641): #03 pc 00064154 /
system/lib/libskia.so
10-13 11:22:03.622: INFO/DEBUG(5641): #04 pc 0004446c /
system/lib/libandroid_runtime.so
10-13 11:22:03.622: INFO/DEBUG(5641): code around pc:
10-13 11:22:03.622: INFO/DEBUG(5641): ac04ab1c 0a00001a e1a06005
ebffff9f e1a0c004
10-13 11:22:03.622: INFO/DEBUG(5641): ac04ab2c e8b6000f e8ac000f
e8b6000f e8ac000f
10-13 11:22:03.622: INFO/DEBUG(5641): ac04ab3c e8960003 e88c0003
e5950004 e3500000
10-13 11:22:03.622: INFO/DEBUG(5641): code around lr:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10-13 11:22:03.892: INFO/DEBUG(5641): debuggerd committing suicide to
free the zombie!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en