5,604,730 Members 32,432 Now Online
XDA Developers Android and Mobile Development Forum

StackOverflowError in getString()

Tip us?
 
GR0S
Old
(Last edited by GR0S; 21st January 2014 at 12:52 PM.)
#1  
Senior Member - OP
Thanks Meter 129
Posts: 632
Join Date: Jun 2012
Default StackOverflowError in getString()

Here's crash stack http://pastebin.com/C5pGuhKh
this started after I moved hardcoded strings into .xml with automatic refactoring (IDEA13)

Very strange
 
SimplicityApks
Old
#2  
SimplicityApks's Avatar
Senior Member
Thanks Meter 281
Posts: 255
Join Date: May 2013
Location: Aachen
Quote:
Originally Posted by GR0S View Post
Here's crash stack http://pastebin.com/C5pGuhKh
this started after I moved hardcoded strings into .xml with automatic refactoring (IDEA13)

Very strange
Well it seems that you are recursively calling your toString method in the HeroFragment... Could you give us the code of that method?
 
GR0S
Old
#3  
Senior Member - OP
Thanks Meter 129
Posts: 632
Join Date: Jun 2012
http://pastebin.com/pFK2TTEe
 
GR0S
Old
#4  
Senior Member - OP
Thanks Meter 129
Posts: 632
Join Date: Jun 2012
http://pastebin.com/nkwsxCsb PagerAdapter
http://pastebin.com/BnTu6Bni Fragment
 
SimplicityApks
Old
#5  
SimplicityApks's Avatar
Senior Member
Thanks Meter 281
Posts: 255
Join Date: May 2013
Location: Aachen
Quote:
Originally Posted by GR0S View Post
That's a really funny error... from the logs I would guess that somehow the getString(R.blabla) method needs to get the calling class and also calls toString... Although I don't see that in the Android source code.

My solution would be to just don't override toString at all and use a different name like getTitle to prevent the system from calling that...
 
GR0S
Old
#6  
Senior Member - OP
Thanks Meter 129
Posts: 632
Join Date: Jun 2012
Well it worked before I moved strings. It was return "string"
 
GR0S
Old
#7  
Senior Member - OP
Thanks Meter 129
Posts: 632
Join Date: Jun 2012
Quote:
Originally Posted by SimplicityApks View Post
That's a really funny error... from the logs I would guess that somehow the getString(R.blabla) method needs to get the calling class and also calls toString... Although I don't see that in the Android source code.

My solution would be to just don't override toString at all and use a different name like getTitle to prevent the system from calling that...
Well I won't be able to do that without my own fragment implementation. I found mistake, it's not possible to use getString() before activity attachment, probably I have to mess with reflection.
 
SimplicityApks
Old
#8  
SimplicityApks's Avatar
Senior Member
Thanks Meter 281
Posts: 255
Join Date: May 2013
Location: Aachen
Quote:
Originally Posted by GR0S View Post
Well I won't be able to do that without my own fragment implementation. I found mistake, it's not possible to use getString() before activity attachment, probably I have to mess with reflection.
Right, or you could just make a method returning the required title per id inside your activity that is then called by the ViewPager

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Microsoft Finally Brings Remote Desktop to Windows Phone

You may recall that back in October of last year, Microsoft released itsofficial … more

SideControl Gains New Powers through Xposed

You may recall that a little overa month ago, we first talked about SideCutsby XDA Forum … more

Leak Points to Windows Start Menu’s Return as Soon as August

About a month ago at this year’s Build conference, Microsoft … more

Wearables Walkthrough: Tasker on the Samsung Galaxy Gear – XDA Developer TV

The future certainly looks like it is full of wearables. … more