Мне нужно сделать HTTP-пост с информацией, включая строковые байтовые представления нескольких файлов в одном HTTP-посте. Я получаю довольно много ошибок распределения байтов, и мне было интересно, есть ли лучший способ сохранить эту информацию для последующей публикации на сервере?
Я взял несколько файлов с изображениями и собираю их в одну строку HTTP Post в формате:
name="string byte representation of picture file"×tamp="time"&gps="latitude""longitude",
и т.д.
Logcat:
03-09 22:26:41.329: E/dalvikvm-heap(8716): Out of memory on a 5932438-byte allocation.
03-09 22:26:41.329: I/dalvikvm(8716): "main" prio=5 tid=1 RUNNABLE
03-09 22:26:41.329: I/dalvikvm(8716): | group="main" sCount=0 dsCount=0 s=N obj=0x40020ba0 self=0xddd0
03-09 22:26:41.329: I/dalvikvm(8716): | sysTid=8716 nice=0 sched=0/0 cgrp=unknown handle=-1345025972
03-09 22:26:41.329: I/dalvikvm(8716): at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:~97)
03-09 22:26:41.329: I/dalvikvm(8716): at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:157)
03-09 22:26:41.329: I/dalvikvm(8716): at java.lang.StringBuilder.append(StringBuilder.java:217)
03-09 22:26:41.329: I/dalvikvm(8716): at mfc.generalguixapi8.SaveData2.saveData(SaveData2.java:169)
03-09 22:26:41.329: I/dalvikvm(8716): at mfc.generalguixapi8.SaveData2.onCreate(SaveData2.java:34)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-09 22:26:41.329: I/dalvikvm(8716): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 22:26:41.329: I/dalvikvm(8716): at android.os.Looper.loop(Looper.java:123)
03-09 22:26:41.329: I/dalvikvm(8716): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-09 22:26:41.339: I/dalvikvm(8716): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 22:26:41.339: I/dalvikvm(8716): at java.lang.reflect.Method.invoke(Method.java:521)
03-09 22:26:41.339: I/dalvikvm(8716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-09 22:26:41.339: I/dalvikvm(8716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-09 22:26:41.339: I/dalvikvm(8716): at dalvik.system.NativeStart.main(Native Method)
03-09 22:26:41.339: W/dalvikvm(8716): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)
03-09 22:26:41.339: E/AndroidRuntime(8716): FATAL EXCEPTION: main
03-09 22:26:41.339: E/AndroidRuntime(8716): java.lang.OutOfMemoryError
03-09 22:26:41.339: E/AndroidRuntime(8716): at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:97)
03-09 22:26:41.339: E/AndroidRuntime(8716): at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:157)
03-09 22:26:41.339: E/AndroidRuntime(8716): at java.lang.StringBuilder.append(StringBuilder.java:217)
03-09 22:26:41.339: E/AndroidRuntime(8716): at mfc.generalguixapi8.SaveData2.saveData(SaveData2.java:169)
03-09 22:26:41.339: E/AndroidRuntime(8716): at mfc.generalguixapi8.SaveData2.onCreate(SaveData2.java:34)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.os.Looper.loop(Looper.java:123)
03-09 22:26:41.339: E/AndroidRuntime(8716): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-09 22:26:41.339: E/AndroidRuntime(8716): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 22:26:41.339: E/AndroidRuntime(8716): at java.lang.reflect.Method.invoke(Method.java:521)
03-09 22:26:41.339: E/AndroidRuntime(8716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-09 22:26:41.339: E/AndroidRuntime(8716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-09 22:26:41.339: E/AndroidRuntime(8716): at dalvik.system.NativeStart.main(Native Method)