w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Use of condition if(view==null) in CustomAdapters

The convertView parameter may be a recycled view (for example, after scrolling down, the top rows become invisible, so their View objects are not destroyed, but recycled and passed as parameters for reuse).

However, the very first time a draw request comes, there is no view (e.g. the first time the screen with the list is loaded). Hence, in this case convertView has no value because nothing has been recycled (it is null), in which case you must create the rows using the inflater.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.