android - Get child view inside a Listview Adapter -
inside getview method want specific child view. know adapter holds several items, doing calling getcount:
getcount();
according javadoc:
public abstract int getcount () added in api level 1 how many items in data set represented adapter.
now in getview method:
public view getview(final int position, view convertview, viewgroup parent) { view lastaddeditem = parent.getchildat(getcount()-1); if(lastaddeditem == null) { log.w("listadapter", "view null"); } }
this message appears in logcat
, means view try grab null
.
i've tried this:
view lastaddeditem = parent.getchildat(parent.getchildcount()-1);
so how can grab specific view viewgroup
object?
i know adapter holds several items, doing calling getcount:
yes does, getcount()
(returning items in adapter) method of adapter has nothing getting children of listview
getchildat()
(where should use getchildcount()
return views
present in viewgroup
).
lastaddeditem = parent.getchildat(parent.getchildcount()-1);
this should return non-null view, last view returned getview()
method.
i want animate specific view in viewgroup
if going animate list row(or part of row) when becomes visible register scroll listener listview
, start animation there when target view appearing on screen.
Comments
Post a Comment