Android: Intents causing crash -
i creating simple application android, i'm running weird problem. have 2 activities, , dictionary intentservice. dictionary intentservice reads text file stored in assets folder hashmap. note have both activities in manifest.
this i'm doing :
intent intent = new intent(this, anactivity.class); startactivity(intent); intent intentdict = new intent(this, dictionaryservice.class); startservice(intentdict);
the first activity runs fine, loads second activity , shows it's ui on nexus 7 emulator. when tries run 2nd intent outofmemory error:
05-02 23:29:48.507: i/dalvikvm(797): @ android.os.handler.dispatchmessage(handler.java:99) 05-02 23:29:48.507: i/dalvikvm(797): @ android.os.looper.loop(looper.java:137) 05-02 23:29:48.507: i/dalvikvm(797): @ android.os.handlerthread.run(handlerthread.java:60) 05-02 23:29:48.517: w/dalvikvm(797): threadid=11: thread exiting uncaught exception (group=0x40a71930) 05-02 23:29:48.527: e/androidruntime(797): fatal exception: intentservice[dictionaryservice] 05-02 23:29:48.527: e/androidruntime(797): java.lang.outofmemoryerror 05-02 23:29:48.527: e/androidruntime(797): @ java.util.hashmap.maketable(hashmap.java:555) 05-02 23:29:48.527: e/androidruntime(797): @ java.util.hashmap.doublecapacity(hashmap.java:575) 05-02 23:29:48.527: e/androidruntime(797): @ java.util.hashmap.put(hashmap.java:405) 05-02 23:29:48.527: e/androidruntime(797): @ java.util.hashset.add(hashset.java:95) 05-02 23:29:48.527: e/androidruntime(797): @ com.example.androidapp.dictionary.readindata(dictionary.java:73) 05-02 23:29:48.527: e/androidruntime(797): @ com.example.androidapp.dictionary.<init>(dictionary.java:35)
now problem that, when these individually work fine. if run 1 of 2 intents application works normally. i've tried calling dictionaryservice intent newly loaded activity (anactivity) results in same error. emulator has 1024 mb of ram allocated it's not doesn't have enough memory. ideas?
thanks
if getting outofmemory exceptions passing around large intents, running out of dalvik heap memory. though machine in case has 1024 mb of ram, android limits each individual dalvik heap 16-64 mb, based on specific device on running.
for more detail, read informative answer: detect application heap size in android
Comments
Post a Comment