Okay so i guess this kinda makes sense I'm not really sure how am i suppose to change my data model. I did ((TextView)adapt.getView(0, null, parent)).setText("hello"); adapt.notifyDataSetChanged();
but nothing changed ? On Dec 2, 11:28 am, Mark Murphy <mmur...@commonsware.com> wrote: > Of course. Again, ordinarily, you do not call getView(). > > You are going about your problem in the wrong way. You are attempting > to change your UI directly by grabbing some row out of a ListView and > changing it. That's not going to be reliable at all, since that row > might not exist. Rather, you need to change your data model (whatever > you have an Adapter on), then update the ListView from the revised > model. The way you would update the ListView varies by your type of > Adapter, and it may be automatic. > > > > > > > > > > On Thu, Dec 2, 2010 at 2:18 PM, kiros88 <ghui...@gmail.com> wrote: > > Okay wait so i get the concept tthat u do a getView from an > > ArrayAdapter but what i tried this before during the > > > i called the adapter i used > > ArrayAdapter adapt = new > > ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , > > songs); > > > then after its already created i do > > > public void onItemClick(AdapterView<?> parent, View view, > > int position, long id) { > > > ((TextView)adapt.getView(position+1,null,parent)).setText("hello"); > > > And this doesnt work it crashes the app > > > On Dec 2, 11:06 am, kiros88 <ghui...@gmail.com> wrote: > >> Okay like where do u gets getView I dont see that function in the > >> Listview class or the adapterView class so im not really sure where im > >> suppose to be able to call getView. > > >> On Dec 1, 7:54 pm, Prakash Iyer <thei...@gmail.com> wrote: > > >> > My 2c - you are over-complicating this.The getView is ONLY to give back > >> > the > >> > view for the item that is requested. If you want this item to be colored > >> > X > >> > then do it here. If you want another item to be colored Y then do it when > >> > getView is called for that item. The state maintenance, i.e. what is X > >> > or Y > >> > is done independent of the code within getView which needs to just return > >> > the View... > > >> > As for the specific text, if you are returning a TextView t, then > >> > t.setText > >> > would work. > > >> > On Wed, Dec 1, 2010 at 9:14 PM, kiros88 <ghui...@gmail.com> wrote: > >> > > Okay i dont want to get to many ppl confused so im going to try to ask > >> > > this very simply. When android goes to this function when a user > >> > > clicks on a item on your listview. basically u get a parent who im > >> > > assuming is the array of textview that was set up during the > >> > > setAdapter phase and view which the the corresponding View to which > >> > > the user touched. My main and only questions is i know i can adjust > >> > > the view of View by saying stuff like > > >> > > (TextView)view = setText("hello") > > >> > > during the same time i want to beable to change another TextView in > >> > > the AdapterView like the View after the "View view" so i guess view > >> > > +1 i want to also be able to change that view into another word. > > >> > > Please dont ask me y im doing this just that im doing it for a reason > >> > > I just really need help and i hope this explains that During the > >> > > onItemClick listener function basically I want to adjust 2 different > >> > > Views in the arrays of Views but i have no idea how to access the any > >> > > other view then the given "View view" thats the argument they give you > > >> > > -- > >> > > 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+unsubscr...@googlegroups.com<android-developers%2Bunsubs > >> > > cr...@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+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 3.0.1 Available! -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en