• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

StringIndexOutOfBoundsException

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there.

I am having a problem with my code..
It is force closing when i run it.
With the error: StringIndexOutOfBoundsException

My code:



- Frede1012
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't say in which line this happens, so I'm guessing either line 42 or 43. What is the value of "n"? If it's -1 or equal to the length of "result" you're in trouble.
 
Frederik Bolding
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:You didn't say in which line this happens, so I'm guessing either line 42 or 43. What is the value of "n"? If it's -1 or equal to the length of "result" you're in trouble.



I dont really know, i got help on an irc and did this.
But it is still not working.
Im trying to get the first two lines of the memoryinfo thingy.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just noticing that lines 41 to 45 are not part of any method; it looks like they need to go between lines 12 and 13.
 
Frederik Bolding
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay that fixes the error.
But it still shows the whole meminfo instead of only output string?
 
Frederik Bolding
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nevermind!
Thanks for the help!

/solved
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic