When i try to open my chat class , sometimes it runs properly , sometimes it gives OutOfMemoryError at setContentView line.I can\'t understand what is the cause of problem?
A few things to look at.
Have you provided the background image(s) for several densities? Scaling is sometimes consuming a lot of memory.
Do you use startActivity or startActivityForResult()? In the latter case, your older Activity objects cannot be destroyed.
Do you collect information in the Application class?