문제

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