>
> I had a problem with designing chat custom listview but when i update list
> when user send or receive message it update all previous rows with the name
> of new sender/receiver and seems like one person send/receive all messages!!
>

That code doesn't make a lot of sense...  We don't know what MarkChat is,
for one.  We don't really know how the flag works as well.

But I can tell you that you have a problem with your ViewHolder pattern.
Your title and body variables should be members of the ViewHolder class,
not member variables of your adapter class.  I don't know why you would
really need titleOdd and bodyOdd either...

Also, you have to remember that when a listview updates itself, it will
update every view that it is currently displaying on the screen, at the
very least.  There is nothing you can do to change that.  That means that
getView() will be called one time for each item currently on the screen....

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Mar 29, 2012 at 11:51 AM, AndroidGirl8 <walaamahmou...@gmail.com>wrote:

>
> Hi,
> I had a problem with designing chat custom listview but when i update list
> when user send or receive message it update all previous rows with the name
> of new sender/receiver and seems like one person send/receive all messages!!
>
> i tried everything and then think how to stop list from updating previous
> items and only work with specific current item only , here is what i'm
> using now in baseAdapter.
>
> @Override
> public View getView(int position, View convertView, ViewGroup parent) {
>
> ViewHolder h;
>  View v = null;
>
> if (flag) {
>
> if (convertView == null) {
>  // //for incoming
> h = new ViewHolder();
> v = mInflater.inflate(R.layout.evenbubble, null);
>
> title = (TextView) v.findViewById(R.id.BuddyTitle);
> body = (TextView) v.findViewById(R.id.BuddyMessage);
>  v.setTag(h);
> } else {
> v = convertView;
> }
>  Log.d("FLAG", "" + flag);
> body.setText(groupsMessage.get(position));
>
> title.setText(MarkChat.Name.get(0));
>
> } else {
>
> // /for outcoming
> if (convertView == null) {
>  h = new ViewHolder();
> v = mInflater.inflate(R.layout.oddbubble, null);
>
> titleOdd = (TextView) v.findViewById(R.id.BuddyTitle);
>  bodyOdd = (TextView) v.findViewById(R.id.BuddyMessage);
> v.setTag(h);
> } else {
>
> v = convertView;
> }
> Log.d("FLAG", "" + flag);
>  bodyOdd.setText(groupsMessage.get(position));
>
> titleOdd.setText(MarkChat.Name.get(1));
> }
>  return v;
> }
>
>  --
> 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

-- 
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

Reply via email to