再会!我为微调器选择鱼创建了适配器,但是列表很长(大约 1,000 项),并且在较慢的设备上是一个错误。我是否需要一个适配器来为 350 个项目形成三种不同的资源:
- R.array.fish1(350 项)
- R.array.fish2(350 项)
- R.array.fish3(350 项)?
如果这解决了我的问题?
adapterfish = ArrayAdapter.createFromResource(this, R.array.fish, android.R.layout.simple_spinner_item);
日志猫
10-30 19:39:16.234: D/dalvikvm(333): GC_FOR_MALLOC freed 3242 objects / 284416 bytes in 56ms
10-30 19:39:16.304: W/dalvikvm(333): ReferenceTable overflow (max=512)
10-30 19:39:16.304: W/dalvikvm(333): Last 10 entries in JNI local reference table:
10-30 19:39:16.314: W/dalvikvm(333): 502: 0x44f89ed0 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 503: 0x44f89f30 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 504: 0x44f89f98 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 505: 0x44f8a0a8 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 506: 0x44f8a100 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 507: 0x44f8a158 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 508: 0x44f8a1b0 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 509: 0x44f8a200 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 510: 0x44f8a338 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.314: W/dalvikvm(333): 511: 0x44f8a388 cls=Ljava/lang/String; (28 bytes)
10-30 19:39:16.324: W/dalvikvm(333): JNI local reference table summary (512 entries):
10-30 19:39:16.324: W/dalvikvm(333): 3 of Ljava/lang/Class; 164B (2 unique)
10-30 19:39:16.324: W/dalvikvm(333): 487 of Ljava/lang/String; 28B (487 unique)
10-30 19:39:16.324: W/dalvikvm(333): 20 of Ljava/lang/String; 36B (20 unique)
10-30 19:39:16.324: W/dalvikvm(333): 1 of [Ljava/lang/String; 28B
10-30 19:39:16.324: W/dalvikvm(333): 1 of [Ljava/lang/String; 2292B
10-30 19:39:16.324: W/dalvikvm(333): Memory held directly by tracked refs is 17004 bytes
**10-30 19:39:16.324: E/dalvikvm(333): Failed adding to JNI local ref table (has 512 entries)**
10-30 19:39:16.324: I/dalvikvm(333): "main" prio=5 tid=1 RUNNABLE
10-30 19:39:16.324: I/dalvikvm(333): | group="main" sCount=0 dsCount=0 s=N obj=0x4001d8e0 self=0xccb0
10-30 19:39:16.324: I/dalvikvm(333): | sysTid=333 nice=0 sched=0/0 cgrp=default handle=-1345026008
10-30 19:39:16.324: I/dalvikvm(333): | schedstat=( 3126333106 1444170201 377 )
10-30 19:39:16.324: I/dalvikvm(333): at android.content.res.AssetManager.getArrayStringResource(Native Method)
10-30 19:39:16.334: I/dalvikvm(333): at android.content.res.AssetManager.getResourceStringArray(AssetManager.java:186)
10-30 19:39:16.334: I/dalvikvm(333): at android.content.res.Resources.getStringArray(Resources.java:381)
10-30 19:39:16.334: I/dalvikvm(333): at com.drchernj.petdiary.SearchActivity.onCreate(SearchActivity.java:143)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-30 19:39:16.334: I/dalvikvm(333): at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 19:39:16.334: I/dalvikvm(333): at android.os.Looper.loop(Looper.java:123)
10-30 19:39:16.334: I/dalvikvm(333): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-30 19:39:16.334: I/dalvikvm(333): at java.lang.reflect.Method.invokeNative(Native Method)
10-30 19:39:16.334: I/dalvikvm(333): at java.lang.reflect.Method.invoke(Method.java:521)
10-30 19:39:16.344: I/dalvikvm(333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-30 19:39:16.344: I/dalvikvm(333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-30 19:39:16.344: I/dalvikvm(333): at dalvik.system.NativeStart.main(Native Method)
10-30 19:39:16.344: E/dalvikvm(333): VM aborting
10-30 19:39:17.694: I/Lang change(339): Locale=en
10-30 19:39:18.155: D/dalvikvm(339): GC_FOR_MALLOC freed 3510 objects / 198664 bytes in 61ms
非常感谢您的帮助和支持!