What does logcat say? see http://developer.android.com/intl/de/guide/developing/tools/adb.html and http://www.adrianvintu.com/blogengine/post/Colored-Logcat-Script-for-Windows.aspx if you don't know what logcat is.
BR, Adrian Vintu http://www.adrianvintu.com On Thu, Jun 10, 2010 at 4:28 PM, svebee <[email protected]> wrote: > hello, as I'm beginner in Android I have problem with memory - after > only 2-3 minutes I get Force Close and outOfMemory Error. > > I have only onCreate (I know, stupid, but I didn't knew for anything > else as I started only few weeks ago) and inside I have... > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > many lines of code...manipulating with SQLite databases... > > } > > inside main XML layout I have many images, small, big (background) and > so on...How can I on every onCreate "delete" all content from memory > that was before in it - so when I open activity again, it deletes all > images and everything out and insert the new (old) one inside. > "Little" awkward but that's only thing I have on mind. > > Also, inside "many lines of code" I don't declare any images! > > Or simply, how can I "bypass" outOfMemoryError? Do I have to do > something like this? > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > BitmapFactory.Options options=new BitmapFactory.Options(); > options.inSampleSize = 8; > Bitmap buildingBitmap = > BitmapFactory.decodeResource(null,R.drawable.background,options); > > if (buildingBitmap != null) > { > buildingBitmap.recycle(); > System.gc(); > buildingBitmap = null; > } > > setContentView(R.layout.main); > > many lines of code...manipulating with SQLite databases... > > } > > or...? Also on other activity is everything "the same" except I have > multiple overlays, how can I "erase" (recycle) them also? Thank you > for any help. > > *currently, I'm not searching for fastest, most "correct" or better > solution, I just want something that it's not crashing all the time > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

