be displayed (the items in your array) and those currently on the
screen. Only the ones on the screen need to have View objects.
getView() is an optimization method that allows you to reuse
previously constructed Views as items scroll off the screen and others
scroll on. If the View that's received in getView() is non-null and of
the right type for the array item at the given position that's coming
onto the screen, then all you need to do is set the state of all of
the items in the View by calling setText(), setChecked(), etcetera to
match the state of the array item.
In your case it sounds like an action performed on one item in your
array, via its View, can affect the state of another item in your
array. If that's the case, then all you need to do is update the state
of the affected item(s) in your array when the action is performed,
and then call your array adapter's notifyDataSetChanged() method. This
will force a refresh of all of the items currently displayed.
On Dec 1, 2:53 pm, kiros88 <ghui...@gmail.com> wrote:
> Well okay so my main purpose to asking was in my app i wanted the user
> to be able to select the textview from the listview and once the user
> touches it the text changes colors. but i want also that if the user
> touches a new text the original one he touch goes back to the original
> color while the new one he touch changes colors. so to do taht i need
> to be able to find the previous textview taht i manipulated during the
> setOnClickListenerView so i figure if i can find the textview from the
> array i should be able to get the previous one but im still just
> confused with the call because i dont get the argument in the middle
> taht u send a "View convertView"
>
> On Dec 1, 10:34 am, Prakash Iyer <thei...@gmail.com> wrote:
>
> > Isn't getView called from the system and you override it to give back a view
> > typically to display a list item? You say that you are calling getView - any
> > specific reason?
>
> > On Wed, Dec 1, 2010 at 1:22 PM, kiros88 <ghui...@gmail.com> wrote:
> > > so basically im trying to figure out what "View convertView" means
> > > exactly. On the definition it says
>
> > > "The old view to reuse, if possible. Note: You should check that this
> > > view is non-null and of an appropriate type before using. If it is not
> > > possible to convert this view to display the correct data, this method
> > > can create a new view."
>
> > > so if I call getView should my convertView be a default view in case i
> > > can't get get the view from my adapterView?
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment