[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-06 Thread Yahel
You might want to try just tossing a System.gc() Thanks for your answer, unfortunately, I'm already doing it : //Try to avoid crashing with outofmemory in the app oncreate try{ setContentView(R.layout.main); } catch (Exception e) { System.gc(); System.runFinalization();

[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-03 Thread Senthil ACS
onCreate gets called when u turn change the orientation if you are not handling orientation changes in the manifest. I have seen so many ppl complaining of this. The perfect solution is given in this link http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html If its failing to

[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-02 Thread Streets Of Boston
You haven't shown us enough of your code (code snippets) for us to begin figuring out what may be wrong with your app. Could you provide more details? But to your questions; 1. The onCreate is called once per Activity instance. If you have instance-variables/fields in you activity, you can assume

[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-02 Thread Yahel
Thank you for your answer. So now I understand that the onCreate method can be called several time, for example on orientation change. My app is set to Portrait mode only using manifest's android:screenOrientation=portrait so I don't expect any orientation change in the app. Could there be any

[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-02 Thread Yahel
Thank you for your answer. You haven't shown us enough of your code (code snippets) for us to... Yes sorry about that, it's just that I don't seem to understand where everything goes wrong. The line giving me an error is a simple setContentView with a simple background image in a FrameView. So

[android-developers] Re: OutOfMemory exception in OnCreate

2010-10-02 Thread Lance Nanek
You might want to try just tossing a System.gc() in early on in your onCreate. That almost always solves out of memory problems for me on Android. It's a shame the memory management is so badly written that it needs this. You aren't supposed to be able to get an out of memory error when garbage