android - on Scrolling ListView , My activity gets stopped -


i have arrayadapter follows :

public class smsarrayadapter extends arrayadapter<string> {      list<string> smsbody;     list<boolean> status;     list<string> time;     list<string> smsmessageid;      context context;     private static layoutinflater inflater = null;     string fromnumber;      public smsarrayadapter(context context, int resource, list<string> smsbody,             list<boolean> status, list<string> time, list<string> smsmessageid,             string fromnumber) {         super(context, resource, smsbody);         this.smsbody = smsbody;         this.status = status;         this.context = context;         inflater = (layoutinflater) context                 .getsystemservice(context.layout_inflater_service);         this.fromnumber = fromnumber;         this.time = time;         this.smsmessageid=smsmessageid;     }      public string getstr(int position) {         return smsbody.get(position);     }     public string getid(int position)     {         return smsmessageid.get(position);     }     public void setread(int position,string smsmessageid)     {         status.set(position, true);         contentvalues values = new contentvalues();         values.put("read", true);         context.getcontentresolver().update(uri.parse("content://sms/inbox"), values, "_id=" +smsmessageid, null);     }     @override     public string getitem(int position) {         // todo auto-generated method stub         return smsbody.get(position);     }      public static class viewholder {          public textview textfrom;         public textview text_sms;         public textview text_time;      }      @override     public view getview(int position, view convertview, viewgroup parent) {          viewholder holder;         if (convertview == null) {              /****** inflate tabitem.xml file each row ( defined below ) *******/             convertview = inflater.inflate(r.layout.row_item, null);              /****** view holder object contain tabitem.xml file elements ******/              holder = new viewholder();              holder.textfrom = (textview) convertview                     .findviewbyid(r.id.textview_from);             holder.text_sms = (textview) convertview                     .findviewbyid(r.id.textview_sms);             holder.text_time = (textview) convertview                     .findviewbyid(r.id.textview_time);              /************ set holder layoutinflater ************/             convertview.settag(holder);         } else             holder = (viewholder) convertview.gettag();           holder.textfrom.settext(" " + fromnumber);          string smstexttodisplay = smsbody.get(position);         if (smstexttodisplay.length() > 100)             smstexttodisplay = smstexttodisplay.substring(0, 99) + " ...";          holder.text_sms.settext(smstexttodisplay);           holder.text_time.settext(time.get(position));         if (status.get(position) == false) {             convertview.setbackgroundcolor(context.getresources().getcolor(                     r.color.light_blue_overlay));          }         return convertview;     }  } 

on scrolling listview of adapter , activity gets stopped . how can avoid error ? error ?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -