• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

SpannableString crashes on some devices only

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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: 65365
248
  • Mark post as helpful
  • send pies
  • 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: 5765
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • 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
  • 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: 65365
248
  • Mark post as helpful
  • send pies
  • 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: 5765
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • 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: 65365
248
  • Mark post as helpful
  • send pies
  • 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.
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!