Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7193151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:06:42+00:00 2026-05-28T20:06:42+00:00

I am getting a NullPointerException at SuggestionSpan. (Stack trace included below). As the stack

  • 0

I am getting a NullPointerException at SuggestionSpan. (Stack trace included below). As the stack trace does not include any of my code, I have absolutely no idea where to start debugging.

The error can be reproduced whenever I press space (or select a word) while using an EditText. I tried multiple keyboards including the stock Android one but the same error appears.

FATAL EXCEPTION: main
java.lang.NullPointerException
at android.text.style.SuggestionSpan.<init>(SuggestionSpan.java:128)
at android.text.style.SuggestionSpan.<init>(SuggestionSpan.java:101)
at android.widget.SpellChecker.createMisspelledSuggestionSpan(SpellChecker.java:392)
at android.widget.SpellChecker.onGetSuggestions(SpellChecker.java:300)
at android.view.textservice.SpellCheckerSession.handleOnGetSuggestionsMultiple(SpellCheckerSession.java:198)
at android.view.textservice.SpellCheckerSession.access$000(SpellCheckerSession.java:86)
at android.view.textservice.SpellCheckerSession$1.handleMessage(SpellCheckerSession.java:112)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

EDIT: I can only reproduce the error on my Nexus S with 4.0.3, but not on emulators with other OS versions. Weird.

EDIT 2: Strange thing happened! I just dragged an EditText into another activity and the same thing happens. No code is attached to it nor any XML changes made to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:06:43+00:00Added an answer on May 28, 2026 at 8:06 pm

    After days of investigation, it turns out that getResources().getConfiguration().locale is null. I am not sure if it is a problem specific to some versions of Android / some devices (mine is Nexus S running 4.0.3).

    But I worked around this issue by checking in the constructor of the Activity (since the context given to the SuggestionSpan is my Activity) whether the locale is null, and then set it to the default one if it is.

        // to prevent a weird bug where locale is null
        Configuration config = getResources().getConfiguration();
        if (config.locale == null)
            config.locale = Locale.getDefault();
    

    That’s what I did. I am quite sure it’s not the best way though. Anyone have any more ideas?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am writing code for btree algorithms. i am getting NullPointerException . why???? please
I'm getting a strange NullPointerException, evidently thrown by the following line of code: Iterator<Note>
Im not sure why im getting NullPointerException. The method getQuestion() currently points to a
I am getting NullPointerException from the below line sometimes. System.out.println(Date::+ row != null ?
I am getting a NullPointerException raised in this code very rarely. This is part
I have and image (img1.png) in my drawable-hdpi folder, but im getting NullPointerException(?) when
I'm trying to code an app that uses the camera. I'm getting a NullPointerException
I'm getting a NullPointerException in the following Hibernate code. I've marked the line with
I have a about screen that has some buttons, but I keep getting NullPointerException
I'm getting a NullPointerException on my Dialog. Here's my code: @Override public boolean onDoubleTap(MotionEvent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.