Add Words to Android's UserDictionary

前端 未结 3 851
逝去的感伤
逝去的感伤 2020-12-08 11:25

I want to add an entire medical dictionary to my android phone (Moto Droid). I would like to be able to send text messages and have the medical words be in the predictable t

相关标签:
3条回答
  • 2020-12-08 11:46

    mm mm where UserDictionary is defined? maybe you should just

    UserDictionary = new UserDictionaryType();
    UserDictionary.Words = new WordsType();
    

    OR define in the class just under the class declaration the fallowing :

     static UserDictionaryType UserDictionary;
    

    if that's the case it's obvious why your app crashed ... (do it on kernel mode and "Houston we got a problem" you cant access pointer that you didnt allocated memory for even in java which is managed code... )

    but again I am not familiar with your code show us where it defined and I would try to help you more ...

    EDIT1: even if UserDictionary exists in the API you didn't declare on one... you should declare somewhwere static UserDictionary ud = new UserDictionary();

    0 讨论(0)
  • 2020-12-08 11:49

    Add this to your app's AndroidManifest.xml file outside of the <application> element:

    <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY"></uses-permission>
    
    0 讨论(0)
  • 2020-12-08 11:50

    Try setting a breakpoint at the start of your activity and stepping through the code with the debugger. This should help you isolate whether that call is really what is causing the crash, and what the underlying exception is.

    0 讨论(0)
提交回复
热议问题