java - Cannot resolve symbol "LayoutInflater inflater,ViewGroup container" -


i have method "displayeventinvitationlist" have parameters "inflater,container" when call method "displayeventinvitationlist(layoutinflater inflater,viewgroup container)" in "onoptionsitemselected" getting error cannot resolve symbol "inflater,container".please suggest me code how solve problem.

 public boolean onoptionsitemselected(menuitem item) {         log.d("onoptionsitemselected", "yes");          switch (item.getitemid()) {             case r.id.all:                 //i getting "cannot resolve symbol" here                   displayeventinvitationlist(layoutinflater inflater,viewgroup container);                  return true;             case r.id.event:                 displayeventlist();                 return true;             case r.id.invitation:                 displayinvitationlist();                 return true;             default:                 return super.onoptionsitemselected(item);          }      } public view displayeventinvitationlist(layoutinflater inflater, viewgroup container) {         context = getactivity().getapplicationcontext();         view = inflater.inflate(r.layout.chatwindow_tab, container, false);         sharedpreferences = context.getsharedpreferences(constants.shared_preference_name,                 context.mode_private);         databasehelper dbhelper = new databasehelper(context);         final usermo usermo = dbhelper.getringeeuserdata(1);         new asynctask<void, void, list<eventmo>>() {             @override             protected list<eventmo> doinbackground(void... arg0) {                 eventmos = gson.fromjson(eventdelegates.getalleventfromuser(usermo, context), new typetoken<list<eventmo>>() {                 }.gettype());                 invitationmos = gson.fromjson(eventdelegates.getalleventforuser(usermo, context), new typetoken<list<eventmo>>() {                 }.gettype());                 list<eventmo> groupeventinviteslist = new arraylist<>();                  (eventmo eventmo : eventmos) {                     groupeventinviteslist.add(eventmo);                  }                 (eventmo eventmo : invitationmos) {                     groupeventinviteslist.add(eventmo);                  }                  return groupeventinviteslist;              }              @override             protected void onpostexecute(list<eventmo> groupeventinviteslist) {                 groupeventmolist = groupeventinviteslist;                 chatdisplayadapter = new chatdisplayadapter();                 groupeventview.setadapter(chatdisplayadapter);                 groupeventview.setadapter(dataadapter);                 groupeventview.setitemscanfocus(true);                 groupeventview.settextfilterenabled(true);                 groupeventview.setonitemclicklistener(groupeventview.getonitemclicklistener());             }         }.execute(null, null, null);         return view;     } 

building on comment, problem not providing arguments method call:

displayeventinvitationlist(layoutinflater inflater,viewgroup container); 

if extending fragment create class, 1 option store layoutinflater , viewgroup arguments oncreateview. save these class variables , use them in onoptionsitemselected.

//class variables layoutinflater inflater; viewgroup container; //... @override public view oncreateview (layoutinflater inflater, viewgroup container, bundle savedinstancestate) {     this.inflater = inflater;     this.container = container; }  //and in onoptionsitemselected... displayeventinvitationlist(inflater, container); 

failing that, need find way access appropriate layoutinflater , viewgroup object use arguments. layoutinflater relatively straight forward (i.e. layoutinflater li = layoutinflater.from(context);) , need access correct viewgroup layouts , widgets render.

also, way structured method call implies not understand java basics when comes method calls/declarations, essential understand android. so, recommend take time familiarise them.


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 -