I'm relatively new to Android and have been developing a simple app for a little while. All the features of the app have been working however now I have encountered a java.lang.OutOfMemoryError: [memory exhausted]
error.
I have read up online about how this error is caused but most of these answers are about bitmap images using up too much memory. My app only uses image buttons that are 50dp x 50dp big so I don't think it's these are causing the error.
I have used the DDMS and looked into the heaps etc. The picture below illustrates that a high amount of the memory is being used however the data on how means nothing to me.
To give you an outline my app is basically a series of input forms and the data is stored in the database. One of the input forms is 50 fields long so maybe the problem is here somewhere? I am using the Genymotion emulator to run/test my application.
I would appreciate it if somebody could highlight where the memory is being used up and how to solve this problem.
Thanks in advance.
EDIT:
The code below posted by Kristy helped to identify where the error was, from there I was able to spot the issue which was very simple cursor.moveToNext
was actually cursor.moveToFirst
this obviously caused an issue with the cursor which caused the program to run out of memory.