My android app keeps crashing when I change the device font.

Put your problem here if it does not fit any of the other categories.

My android app keeps crashing when I change the device font.

Postby Trollypolly » Mon Oct 01, 2012 6:30 am

I have an android app I am working on in Eclipse. It has 1 activity with some fragments in it which works fine. But when I go into any of my fragments, which either consist of a layout statically made or dynamically made, I then hit the menu button and go to the "Display" section of my phone to change the font of my android device Ex) Normal to Large or Large to Normal. Once I do that I open my app again thinking that the text in my app should grow/shrink and still be on the same fragment like I have seen in other apps but instead it just crashes.

I have a feeling it has to do something with the fragment or my activity's lifecycle methods but I honestly do not even know where to begin. I understand how the lifecycles flow but as for putting code into these methods to fix this issue I do not even know where to begin. The only methods so far I have used/Override with my code in it is the "onCreate()" in my Activity and "onCreateView()" in my fragments. Does anyone have a solution as to why it is doing this?


This Log.i code snippet here is when I go from Activity (MainActivity) -> ListFragment (JungleListFragment) -> Fragment (JungleInfo)
Code: Select all
10-01 05:10:25.734: I/MainActivity(712): onCreate
10-01 05:10:26.564: I/MainActivity(712): onStart
10-01 05:10:26.564: I/MainActivity(712): onResume
10-01 05:10:29.304: I/JungleListFragment(712): onAttach
10-01 05:10:29.304: I/JungleListFragment(712): onCreateView
10-01 05:10:29.344: I/JungleListFragment(712): onActivityCreated
10-01 05:10:31.234: I/JungleListFragment(712): onDestroyView
10-01 05:10:31.234: I/JungleInfo(712): onAttach
10-01 05:10:31.234: I/JungleInfo(712): onCreate
10-01 05:10:31.234: I/JungleInfo(712): onCreateView
10-01 05:10:31.664: I/JungleInfo(712): onActivityCreated


Now I just went and changed the devices font size and then re-entered my app and this is what I get:

Code: Select all
10-01 05:14:06.783: I/JungleInfo(712): onPause
10-01 05:14:06.783: I/MainActivity(712): onPause
10-01 05:14:08.463: I/MainActivity(712): onStop
10-01 05:14:24.653: I/JungleInfo(712): onDestroyView
10-01 05:14:24.693: I/MainActivity(712): onDestroy
10-01 05:14:24.733: I/JungleListFragment(712): onAttach
10-01 05:14:24.733: I/JungleInfo(712): onAttach
10-01 05:14:24.733: I/JungleInfo(712): onCreate
10-01 05:14:24.733: I/MainActivity(712): onCreate
10-01 05:14:25.423: I/JungleInfo(712): onCreateView
10-01 05:14:25.563: D/AndroidRuntime(712): Shutting down VM
10-01 05:14:25.643: W/dalvikvm(712): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-01 05:14:25.743: E/AndroidRuntime(712): FATAL EXCEPTION: main
10-01 05:14:25.743: E/AndroidRuntime(712): java.lang.RuntimeException: Unable to start activity ComponentInfo{(*packageinfo*).MainActivity}: java.lang.NullPointerException


Hope this may help find a solution as to why it is doing this cause I am just completely lost.
Trollypolly
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Oct 01, 2012 6:27 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests