Maps in Android CardView in Recycler View -


i'm trying inflate card view in recycler adapter view , error no such instance kasualjob im. here adapter

public class kasualjobadapter extends recyclerview.adapter<kasualjobadapter.myviewholder> {     private googlemap mmap;     protected latlng mmaplocation;     private list<kasualjob> kasualjoblist;     private fragmentmanager fragmentmanager;      public kasualjobadapter(list<kasualjob> kasualjoblist, fragmentmanager fragmentmanager) {         this.kasualjoblist = kasualjoblist;         this.fragmentmanager = fragmentmanager;     }     public class myviewholder extends recyclerview.viewholder {         public textview kasualjobtitle, kasualjobdescription, kasualjoblocation, kasualjobdateposted, kasualjobuser;         public supportmapfragment kasualjobmap;          public myviewholder(final view view) {             super(view);              kasualjobtitle = (textview) view.findviewbyid(r.id.textview_kasual_job_name);             kasualjobdescription = (textview) view.findviewbyid(r.id.textview_kasual_job_description);             kasualjoblocation = (textview) view.findviewbyid(r.id.textview_kasual_job_location);             kasualjobdateposted = (textview) view.findviewbyid(r.id.textview_kasual_job_date_time_posted);             kasualjobuser = (textview) view.findviewbyid(r.id.textview_kasual_job_user);              kasualjobmap = (supportmapfragment)fragmentmanager.findfragmentbyid(r.id.kasual_job_mapview);              kasualjobmap.getmapasync(new onmapreadycallback() {                 @override                 public void onmapready(googlemap googlemap) {                     mmap = googlemap;                      // add marker in sydney , move camera                     latlng sydney = new latlng(-34, 151);                     mmap.addmarker(new markeroptions().position(sydney).title("marker in sydney"));                     mmap.movecamera(cameraupdatefactory.newlatlng(sydney));                 }             });         }          public void setmaplocation(double lat, double lon) {             mmaplocation = new latlng(lat, lon);              if (mmap != null) {                 updatemapcontents();             }         }          protected void updatemapcontents() {             mmap.clear();             // update mapview feature data , camera position.             mmap.addmarker(new markeroptions().position(mmaplocation));             cameraupdate cameraupdate = cameraupdatefactory.newlatlngzoom(mmaplocation, 10f);             mmap.movecamera(cameraupdate);         }      }      @override     public myviewholder oncreateviewholder(viewgroup parent, int viewtype) {         view itemview = layoutinflater.from(parent.getcontext())                 .inflate(r.layout.kasual_job_card_view, parent, false);          return new myviewholder(itemview);     }      @override     public void onbindviewholder(myviewholder holder, int position) {         kasualjob kasualjob=kasualjoblist.get(position);         holder.kasualjobtitle.settext(kasualjob.getkasualjobtypename());         holder.kasualjobdescription.settext(kasualjob.getkasualjobdescription());         holder.kasualjoblocation.settext("for know utalii,nairobi,kenya");         holder.setmaplocation(kasualjob.getkasualjoblatitude(), kasualjob.getjoblongitude());         holder.kasualjobdateposted.settext("on " + kasualjob.getkasualjobdatetimeposted());         holder.kasualjobuser.settext("by " + kasualjob.getuserfirstname()+ " "+ kasualjob.getuserlastname());     }      @override     public int getitemcount() {         return kasualjoblist.size();     } } 

can please me out can render maps , if possible explain me i'm doing wrong

try move

holder.kasualjobmap.getmapasync(new onmapreadycallback() {         @override         public void onmapready(googlemap googlemap) {             mmap = googlemap;              // add marker in sydney , move camera             latlng sydney = new latlng(-34, 151);             mmap.addmarker(new markeroptions().position(sydney).title("marker in sydney"));             mmap.movecamera(cameraupdatefactory.newlatlng(sydney));         }     }); 

into method onbindviewholder.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -