File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Leak Found Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Leak Found Exception" Watch "Leak Found Exception" New topic
Author

Leak Found Exception

yash wardhan
Ranch Hand

Joined: Jan 22, 2008
Posts: 46

Hi All,

I have an activity in which I am showing data in list format. The input for the list is comming from DB and I am using my own adapter class which extends SimpleCursorAdapter.
I am retrieving cursor from db class but I haven't closed the cursor myself, rather I have passed this cursor to startManagingSursor(), so I guess this will handle the closing cursor part. But when I am going to new activity from my ListActivity, I am getting Leak Found Exception.
Can any one please tell me how can I fix this?

Thanks in advance.
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi,

Can you please please paste the code here?, so I can have more idea. I think its related with database. It might be remained opened at some point.

Thanks
Pratik Goswami.


iOS * Android Developer
yash wardhan
Ranch Hand

Joined: Jan 22, 2008
Posts: 46
Hi Pratik,

This is the code


I tried closing the cursor in my getView() as last statement but then I am not able to see the list, it is showing the blank screen.
And closing it at the end of the above code gives some other exception.
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi,
Try to deactivate cursor instead of closing it.


Thanks
Pratik Goswami
yash wardhan
Ranch Hand

Joined: Jan 22, 2008
Posts: 46
Hi Pratik,

Thanks for your reply.

I tried your suggession but it is also not working.
Rather it is not showing the list itself. However, when I checked the logs, I can see the correct number of records fetched from DB.
When I deactivate the cursor in ListActivity class, I am getting empty message that I set in layout.xml for list and when I deactivate it in my adapter class's getView() it is not showing anything not even empty message.

Anyone please tell the solution.


Thanks
yash wardhan
Ranch Hand

Joined: Jan 22, 2008
Posts: 46
Any iputs please? Still couden't solve the problem.


Waiting for reply
yash wardhan
Ranch Hand

Joined: Jan 22, 2008
Posts: 46
ANy reply android experts, still getting the exception
 
 
subject: Leak Found Exception