Skip to content Skip to sidebar Skip to footer

Application Has Too Many Files Open - Android

I have a method called calcDays() which loops through a database over and over again until a certain condition is met. The problem is that Android studio is telling me that I've ru

Solution 1:

You should be creating only a single SqliteOpenHelper object for your entire app, and use that wherever database access is required. This will prevent a lot of problems with concurrent access to the database.

Solution 2:

I was facing the same issue and I managed to solve it by closing the cursor by calling the following where I left it open:

cursor.close();

I was creating a new object of the Cursor class inside a loop without closing it. While on small loop iterations it was working fine, after the data got bigger and the loop iterations too then I started seeing this problem.

Post a Comment for "Application Has Too Many Files Open - Android"