Using Fragment Arguments gets me the unfortunate pop-up


#1

hey guys i would greatly appreciate if you could help me on this one,

i used direct activity retrieval with the putExtra and getSerializableExtra… it works
but when i change the code using the fragment argument with the getArguments.getSerializable… I get the unfortunate pop-up error

and aside from that… i noticed when i trace the calls just using the direct retrieval, the onCreate() of CrimeFragment got called twice? although as ive said it works but still i was confused why?

pls help me understand this thanks.


#2

guys… my bad… :slight_smile:

i didn’t comment out the onCreate() of the CrimeActivity when in fact im already using the SingleActivityFragment class or should i say extending it to be proper, that’s why the onCreate() of CrimeFragment was called twice and i figure the 2nd time it was called it uses the fragment instance that was explicitly created by the CrimeActivity which doesn’t have any crimeId so when CrimeFragment retrieve it, it gets nullpointer… i hope i understand that correctly…

appreciate if someone could concur on that one… thanks.

Love the books :slight_smile:


#3

Glad you got it figured out - and thanks!