I have a custom Adapter and I want to keep a reference to its ListView as a private member variable in the Adapter. Is this going to create a memory leak? Neither the Adapter nor the ListView are static.

Thanks!

有帮助吗?

解决方案

That's your custom adapter, do what ever you want with it!! It will not leak memory at all because you only store a reference to your listview.

其他提示

I'm not 100% sure, but won't ListView leak when stored in Adapter which instance is keept in Fragment with setRetainInstance(true)?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top