views:

462

answers:

1

I am using kind of results search engine, problem is to remember the searching criteria i made singleton static class which keeps only one instance.

In my application there are lots of class level private variables, lots of public static variables, a big util class which contains only static final methods.

problem is my application get crash any time any where any spot and interesting thing is crash code always surrounded by try{} catch(Throwable e){} block but never catch, i think it may be memory full issue.

I want to discuss one sample case, on the result page i also display result related image, i download image from web and using drawable i place image in the imageview, i created static hashmap to reuse images, some time after downlaod 5 images application crash some times click on a result get user to new detail screen get crash and all code surrounded by try catch block, i am new to mobile program this thing has become night mare to me.

Last thing, On emulator hardly application crash but when i try to test the application on device, i am using samsung glaxy android supported to test the application it goes smoth and suddenly it start getting crashed, and after crash android relaunch the activity that throws null pointer exception on every click and caught by try{}catch{} block i think after crashing android dealocate all objects only keep the UI objects thats why when after crash i auto launch the activity clicking causes null pointer exception.

how can i stop relaunching crashed activity ????

+1  A: 

Here are some suggestions that might help track down your issue(s):

  • introduce logging - use Log to log useful (debugging) info
  • avoid empty catch blocks - use Log.e() to log your exceptions
  • reduce functionality to a minimum for debugging

In order to get a useful answer on Stackoverflow you'll have to do all of the above and provide a more detailed problem description (e.g. a specific stacktrace in your logcat output).

Also, there is an article about Avoiding Memory Leaks that might be interesting to you.

Josef
While doing that you might find the cause of the problem yourself.
ChrisF