Unofficial CM12.1 Available for Moto E 2014

While Motorola is yet to release a final 5.0.2 build for the Moto E 2014, XDA Senior … more

Pinsy Brings Social Sketching To Your Watch & Phone

Did you watch Apple’s VP draw on his wrist during the Apple Watch announcement … more

CyanogenMod 12.1 for Samsung Galaxy S5

Android 5.1 is slowly putting its mark in the custom ROM world. CyanogenMod 12.1 is available to … more

Nexus Player 5.1 LMY47D Rooted

We recently featured the Nexus Player, Google’s second attempt at a digital media … more
Post Reply Subscribe to Thread Email Thread

StackOverflowError in getString()

21st January 2014, 12:49 PM   |  #1  
OP Senior Member
Thanks Meter: 137
 
737 posts
Join Date:Joined: Jun 2012
Here's crash stack http://pastebin.com/C5pGuhKh
this started after I moved hardcoded strings into .xml with automatic refactoring (IDEA13)

Very strange
Last edited by GR0S; 21st January 2014 at 12:52 PM.
21st January 2014, 01:44 PM   |  #2  
SimplicityApks's Avatar
Senior Member
Flag Aachen
Thanks Meter: 340
 
346 posts
Join Date:Joined: May 2013
More
Quote:
Originally Posted by GR0S

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?
21st January 2014, 01:51 PM   |  #3  
OP Senior Member
Thanks Meter: 137
 
737 posts
Join Date:Joined: Jun 2012
http://pastebin.com/pFK2TTEe
21st January 2014, 02:16 PM   |  #4  
OP Senior Member
Thanks Meter: 137
 
737 posts
Join Date:Joined: Jun 2012
http://pastebin.com/nkwsxCsb PagerAdapter
http://pastebin.com/BnTu6Bni Fragment
21st January 2014, 02:49 PM   |  #5  
SimplicityApks's Avatar
Senior Member
Flag Aachen
Thanks Meter: 340
 
346 posts
Join Date:Joined: May 2013
More
Quote:
Originally Posted by GR0S

http://pastebin.com/nkwsxCsb PagerAdapter
http://pastebin.com/BnTu6Bni Fragment

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...
21st January 2014, 02:53 PM   |  #6  
OP Senior Member
Thanks Meter: 137
 
737 posts
Join Date:Joined: Jun 2012
Well it worked before I moved strings. It was return "string"
21st January 2014, 03:28 PM   |  #7  
OP Senior Member
Thanks Meter: 137
 
737 posts
Join Date:Joined: Jun 2012
Quote:
Originally Posted by SimplicityApks

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.
21st January 2014, 03:31 PM   |  #8  
SimplicityApks's Avatar
Senior Member
Flag Aachen
Thanks Meter: 340
 
346 posts
Join Date:Joined: May 2013
More
Quote:
Originally Posted by GR0S

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

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes