Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old October 1st, 2012, 12:57 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default My android app keeps crashing when I change the device font.

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, onActivityCreated() in my ListFragment and "onCreateView()" in my fragments. Does anyone have a solution as to why it is doing this?

EDIT: More information to help possibly solve this issue,


This code snippet here is when I go from Activity (MainActivity) -> ListFragment (JungleListFragment) -> Fragment (JungleInfo)
Code:
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:
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.

Advertisements
Trollypolly is offline  
Reply With Quote
sponsored links
Old October 1st, 2012, 04:32 AM   #2 (permalink)
Junior Member
 
Join Date: Aug 2012
Location: Athens, Greece
Posts: 42
 
Device(s):
Carrier: Not Provided

Thanks: 6
Thanked 7 Times in 7 Posts
Default

You have a NullPointerException in your Activity. Can you post the full log and your Java code (especially the OnCreate method)?
Kostas G is offline  
Reply With Quote
Reply
Tags
android, display, lifecycle


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:23 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.