Android adapter item change after click -


i have custom adapter holds humans. these humans have features. want when click 1 of these human , features changed. (like new message in whatsapp). custom adapter class :

    public class gecmisinsanadapter extends arrayadapter<insan> {      arraylist<insan> objects;     arraylist<insan> kokobjects;     int resource;     context context;     layoutinflater lala;     private displayimageoptions options;     filter insanfilter = new filter() {         @override         protected filterresults performfiltering(charsequence constraint) {             filterresults results = new filterresults();             if (constraint == null || constraint.length() == 0) {                 results.values = objects;                 results.count = objects.size();             } else {                 arraylist<insan> sonuclistesi = new arraylist<>();                 (insan : kokobjects) {                     if (i.getname().contains(constraint.tostring())) {                         sonuclistesi.add(i);                     }                 }                 results.values = sonuclistesi;                 results.count = sonuclistesi.size();             }             return results;         }          @override         protected void publishresults(charsequence constraint, filterresults results) {             if (results.count == 0) {                 notifydatasetinvalidated();             } else {                 objects = (arraylist<insan>) results.values;                 notifydatasetchanged();             }         }     };       private string sharedprefbilinmeyenpathal() {         sharedpreferences sp = context.getsharedpreferences("programisleyis", context.mode_private);         return sp.getstring("bilinmeyenresimpath", "defaultbilinmeyenresimpath");     }      public gecmisinsanadapter(context context, int resource, arraylist<insan> objects) {         super(context, resource, objects);         this.objects = objects;         kokobjects = objects;         this.resource = resource;         this.context = context;         options = new displayimageoptions.builder()                 .showimageonloading(r.mipmap.ins)                 .showimageforemptyuri(r.mipmap.soruisareti)                 .showimageonfail(r.mipmap.soruisareti)                 .cacheinmemory(true)                 .cacheondisk(true)                 .considerexifparams(true)                 .displayer(new circlebitmapdisplayer(color.white, 0))                 .build();         lala = (layoutinflater) context.getsystemservice(context.layout_inflater_service);     }      public view getview(int position, view convertview, viewgroup parent) {         final insanholder insanholder;         final int pozisyon = position;         if (convertview == null) {             convertview = lala.inflate(resource, null);             insanholder = new insanholder();             insanholder.insanresmi = (imageview) convertview.findviewbyid(r.id.imgicon);             insanholder.insanadi = (textview) convertview.findviewbyid(r.id.txttitle);             insanholder.insandurumu = (textview) convertview.findviewbyid(r.id.textview20);             insanholder.esasbolge = (linearlayout) convertview.findviewbyid(r.id.esasbolge);             insanholder.yenimesajvarmi = (framelayout) convertview.findviewbyid(r.id.yenimesajvarmi);             insanholder.yenimesajsayisi = (textview) convertview.findviewbyid(r.id.kacyenimesaj);             convertview.settag(insanholder);         } else {             insanholder = (insanholder) convertview.gettag();         }         if(objects.get(position).getresmiacik().equals("degil")){             string bilinmeyenpath = sharedprefbilinmeyenpathal();             bitmap b = bitmapfactory.decodefile(bilinmeyenpath);             insanholder.insanresmi.setimagebitmap(b);             insanholder.insanadi.settext("??????");             insanholder.insandurumu.settext("?????????????");             if(objects.get(position).getyenimesajvarmi().equals("var")){                 insanholder.yenimesajvarmi.setvisibility(view.visible);                 insanholder.yenimesajsayisi.settext(objects.get(position).getkacyenimesaj());             }          }else if(objects.get(position).getresmiacik().equals("acik")) {             string decodedimguri = uri.fromfile(new file(objects.get(position).getresimpath())).tostring();             imageloader.getinstance().displayimage(decodedimguri, insanholder.insanresmi, options);             insanholder.insanadi.settext(objects.get(position).getname());             insanholder.insandurumu.settext(objects.get(position).getdurum());             if(objects.get(position).getyenimesajvarmi().equals("var")){                 insanholder.yenimesajvarmi.setvisibility(view.visible);                 insanholder.yenimesajsayisi.settext(objects.get(position).getkacyenimesaj());             }         }         if(objects.get(position).getbandurumu().equals("evet")){             insanholder.esasbolge.setbackgroundcolor(color.blue);         }         /*servergunceldurumual sgda = new servergunceldurumual();         try {             holder.text2.settext( sgda.execute(objects.get(position).getid()).get());         } catch (interruptedexception e) {             e.printstacktrace();         } catch (executionexception e) {             e.printstacktrace();         }*/         //holder.reportbutonu.setonclicklistener()         insanholder.esasbolge.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {                 objects.get(pozisyon).setkacyenimesaj("0");                 objects.get(pozisyon).setyenimesajvarmi("yok");                 listeyiyenile();                 string name = objects.get(pozisyon).getname();                 string id = objects.get(pozisyon).getid();                 string durum = objects.get(pozisyon).getdurum();                 string resimpath = objects.get(pozisyon).getresimpath();                 string bandurumu = objects.get(pozisyon).getbandurumu();                 string faceprofilurl = objects.get(pozisyon).getfaceprofilur();                 intent intent = new intent(context, mesajlasma.class);                 intent.putextra("faceprofilurl" , faceprofilurl);                 intent.putextra("bandurumu" , bandurumu);                 intent.putextra("karsiserverid", id);                 intent.putextra("karsiisim", name);                 intent.putextra("karsidurum" ,durum);                 intent.putextra("karsiresimpath" , resimpath);                 intent.putextra("intentname", "gecmisinsanadapter");                 context.startactivity(intent);             }         });         /*holder.image1.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 log.i("tago", "kullanıcı resmi tıklandı");                 dialog dialog = new dialog(context);                 dialog.requestwindowfeature(window.feature_no_title);                 dialog.setcontentview(r.layout.dialogkullanici);                 dialog.getwindow().setdimamount(0.7f);                 dialog.show();                 imagebutton imageb1, imageb2, imageb3, imageb4;                 imageb1 = (imagebutton) dialog.findviewbyid(r.id.imagebutton15);                 imageb2 = (imagebutton) dialog.findviewbyid(r.id.imagebutton16);                 imageb3 = (imagebutton) dialog.findviewbyid(r.id.imagebutton17);                 imageb4 = (imagebutton) dialog.findviewbyid(r.id.imagebutton18);                 try {                     imageb1.setimagebitmap(new urldenresimm().execute(objects.get(pozisyon).geturl()).get());                 } catch (interruptedexception e) {                     e.printstacktrace();                 } catch (executionexception e) {                     e.printstacktrace();                 }                 imageb2.setonclicklistener(new view.onclicklistener() {                     public void onclick(view v) {                         intent intent = new intent(context, mesajlasma.class);                         try {                             icon = new urldenresimm().execute(objects.get(pozisyon).geturl()).get();                         } catch (interruptedexception e) {                             e.printstacktrace();                         } catch (executionexception e) {                             e.printstacktrace();                         }                         intent.putextra("isim", objects.get(pozisyon).getname());                         intent.putextra("id", objects.get(pozisyon).getid());                         intent.putextra("resimurl", objects.get(pozisyon).geturl());                         intent.putextra("intentname", "insanadapter");                         bundle bundle = new bundle();                         bundle.putparcelable("kullaniciresmi", icon);                         intent.putextra("kullaniciresmi", bundle);                         context.startactivity(intent);                     }                 });                  imageb3.setonclicklistener(new view.onclicklistener() {                     public void onclick(view v) {                         log.i("tago", "like etme işlemi başlatıldı");                     }                 });                 imageb4.setonclicklistener(new view.onclicklistener() {                     public void onclick(view v) {                         log.i("tago", "kullanici report etme işlemi başlatıldı");                     }                 });             }          });  */         return convertview;     }      private void listeyiyenile() {         notifydatasetchanged();     }       private bitmap getcirclebitmap(bitmap b) {         final bitmap output = bitmap.createbitmap(b.getwidth(), b.getheight(), bitmap.config.argb_8888);         final canvas canvas = new canvas(output);         final int color = color.red;         final paint paint = new paint();         final rect rect = new rect(0, 0, b.getwidth(), b.getheight());         final rectf rectf = new rectf(rect);          paint.setantialias(true);         paint.setcolor(color);         canvas.drawargb(0, 0, 0, 0);         canvas.drawoval(rectf, paint);         paint.setxfermode(new porterduffxfermode(porterduff.mode.src_in));          canvas.drawbitmap(b, rect, rect, paint);         return output;     }      public filter getfilter() {         if (insanfilter==null){             log.i("tago" , "gecmis insanfilter bos");         }         return insanfilter;     }      static class insanholder {         public imageview insanresmi;         public textview insanadi, insandurumu , yenimesajsayisi;         public linearlayout esasbolge;         public framelayout yenimesajvarmi;     } 

these humans in "objects" arraylist come constructor. has "yenimesajvarmi" , "kacyenimesaj" variables. in getview method "insanholder.esasbolge.setonclicklistener(new view.onclicklistener()" part , user clicks area , intent new class. want when user come these variables changed. how can provide ??

"yenimesajvarmi" = "isthereanynewmessage".


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -