here is the code for getView(), public View getView(int position, View convertView, ViewGroup parent) {
View row=super.getView(position, convertView, parent); ViewHolder holder=(ViewHolder)row.getTag(); if (holder==null) { String type="T"; holder=new ViewHolder(row); row.setTag(holder); String blog_type = ((TextView)row.findViewById(R.id.type)).getText().toString(); if(blog_type.equals(type)) { holder.button.setVisibility(Button.GONE); holder.text.setVisibility(TextView.VISIBLE); holder.text1.setVisibility(TextView.GONE); holder.button1.setVisibility(Button.VISIBLE); } holder.button.setTag(row); holder.button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub View r=(View)v.getTag(); String type="A"; String blog_data = ((TextView)r.findViewById(R.id.blog_data)).getText().toString(); String blog_id = ((TextView)r.findViewById(R.id.blog_id)).getText().toString(); String blog_type = ((TextView)r.findViewById(R.id.type)).getText().toString(); if(blog_type.equals(type)) { playMessage(Integer.parseInt(blog_id)); } } }); holder.button1.setTag(row); holder.button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub View r=(View)v.getTag(); String type="T"; String blog_data = ((TextView)r.findViewById(R.id.blog_data)).getText().toString(); String blog_id = ((TextView)r.findViewById(R.id.blog_id)).getText().toString(); String blog_type = ((TextView)r.findViewById(R.id.type)).getText().toString(); String annotation = ((TextView)r.findViewById(R.id.annotation)).getText().toString(); String url = ((TextView)r.findViewById(R.id.url)).getText().toString(); if(blog_type.equals(type)) { Intent message=new Intent(FeedsActivity.this, BlogMessage.class); message.putExtra("blog_data", blog_data); message.putExtra("annotation", annotation); message.putExtra("flag","false"); message.putExtra("url", url); startActivity(message); } } }); holder.text1.setTag(row); holder.text1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub View r=(View)v.getTag(); String type="A"; String blog_data = ((TextView)r.findViewById(R.id.blog_data)).getText().toString(); String blog_id = ((TextView)r.findViewById(R.id.blog_id)).getText().toString(); String blog_type = ((TextView)r.findViewById(R.id.type)).getText().toString(); String annotation = ((TextView)r.findViewById(R.id.annotation)).getText().toString(); String url = ((TextView)r.findViewById(R.id.url)).getText().toString(); if(blog_type.equals(type)) { Intent message=new Intent(FeedsActivity.this, BlogMessage.class); message.putExtra("blog_data", blog_data); message.putExtra("annotation", annotation); message.putExtra("flag","true"); message.putExtra("url", url); message.putExtra("type", type); startActivity(message); } } }); } return row; } class ViewHolder { Button button; TextView text; Button button1; TextView text1; ViewHolder(View base) { this.button=(Button)base.findViewById(R.id.player); this.text=(TextView)base.findViewById(R.id.blog_data); this.button1=(Button)base.findViewById(R.id.textimg); this.text1=(TextView)base.findViewById(R.id.annotation); } } shruthi On Thu, May 24, 2012 at 3:43 PM, imran ali <imran...@gmail.com> wrote: > can you post part of code where your doing visible/invisible of buttons. > I think you are doing some mistake in getView(...) method of Adapter. > and it is going to mess on scroll of listview. > > Regards > Imran Ali > > On Thursday, May 24, 2012 2:56:38 PM UTC+5:30, shruthi santosh wrote: >> >> My feeds list conatins both text feeds and audio feeds. >> I have a button to view the complete text and a button to play the audio >> feeds. >> I am checking the the type of the feed to make the appropriate button >> visible. >> The first four feeds in the list gets the proper buttons but the rest are >> not proper(i mean some text feeds r getting audio button and some audio >> feeds are getting text button) >> Pl. help me with this problem >> >> shruthi >> > -- > 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