• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

SpannableString crashes on some devices only

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://stackoverflow.com/questions/57782159/spannablestring-crashes-on-some-devices-only

This is my post in stackoverflow(long code) and I am having an issue with spannablestring where it is giving me index out of bound error and crashes only on some devices. The errors were reported by Firebase crashlytics and it is shown below. Any help will be appreciated.

 
Marshal
Posts: 73994
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

What's a SpannableString? Is it an android class? If so, I shall move you to the Android forum. How did you get an index of −1? Where are you calling the setSpan() method? We can only help if we know the full details.
Please tell the people on SO about your post here.
 
Saloon Keeper
Posts: 7096
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the stack trace does not actually contain any of your lines of code? So it's probably got nothing to do with your call to setSpan (although you should properly guard against that, as suggested on SO). I've been seeing GUI exceptions like this in my app (in Crashlytics) for years, and have just learned to live with it (it never happened to a device/android version combination I had, so there wasn't much I could do to debug). It's Android code that is crashing, not your code, so there may not be much you can do about it.
 
Calvert Wong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The stack trace doesn't show it, that's why I don't know where to start debug it. I'm just trying my luck to see if anyone has this issue and have a solution or ways to debug it.
 
Campbell Ritchie
Marshal
Posts: 73994
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you posted anything new on SO?

Is that line 2574 the last‑named line in the stack trace? Go through your code with grep or similar to find where you are calling the AccessibilityNodeInfo.setText() method.
 
Tim Moores
Saloon Keeper
Posts: 7096
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote: find where you are calling the AccessibilityNodeInfo.setText() method.


Likely not at all. As I said above, it's Android code crashing, not the app code. The android GUI subsystem does a lot of things on its own.
 
Campbell Ritchie
Marshal
Posts: 73994
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry; I missed that bit. How do you sort out that exception if you aren't causing it yourself? Do you reinstall the OS or something? If yu hae a certain version of Android on different devices, that would explain why the error is device specific.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic