嗨,我一直在制作一个识别手势的应用程序。我正在尝试在我的程序中使用 Google 的手势搜索资源文件。
问题:手势资源文件使我的应用程序和手势生成器(在模拟器上)崩溃
我的问题:Google(以及我将如何)如何加载手势资源文件而不会出现内存错误?
错误日志如下:
03-01 13:02:55.406: E/dalvikvm-heap(32207): Out of memory on a 13893864-byte allocation.
03-01 13:02:55.416: E/AndroidRuntime(32207): FATAL EXCEPTION: main
03-01 13:02:55.416: E/AndroidRuntime(32207): java.lang.OutOfMemoryError
03-01 13:02:55.416: E/AndroidRuntime(32207): at java.util.ArrayList.<init>(ArrayList.java:75)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.gesture.GestureStroke.deserialize(GestureStroke.java:223)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.gesture.Gesture.deserialize(Gesture.java:277)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.gesture.GestureStore.readFormatV1(GestureStore.java:322)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.gesture.GestureStore.load(GestureStore.java:293)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.gesture.GestureLibraries$ResourceGestureLibrary.load(GestureLibraries.java:132)
03-01 13:02:55.416: E/AndroidRuntime(32207): at com.example.transittalker.main.onCreate(main.java:99)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.Activity.performCreate(Activity.java:5008)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2136)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2207)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.ActivityThread.access$600(ActivityThread.java:139)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.os.Looper.loop(Looper.java:137)
03-01 13:02:55.416: E/AndroidRuntime(32207): at android.app.ActivityThread.main(ActivityThread.java:4899)
03-01 13:02:55.416: E/AndroidRuntime(32207): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 13:02:55.416: E/AndroidRuntime(32207): at java.lang.reflect.Method.invoke(Method.java:511)
03-01 13:02:55.416: E/AndroidRuntime(32207): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
03-01 13:02:55.416: E/AndroidRuntime(32207): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
03-01 13:02:55.416: E/AndroidRuntime(32207): at dalvik.system.NativeStart.main(Native Method)