android - Return results to SearchableActivity in Fragment -


situation topic suggest, working on simple app, simple enough few fragments. app simple me querying items online server. however, in app implement search.

problem

although i'm little experienced in searching cannot seem working in fragment. when click "search" blank screen comes up, absent results.

what have done far

so far have wrote search , volley have reason believe fine. in

public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {

the oncreateview grey, signifying isnt being called or used anywhere. breakpoints placed arent activated. making believe never activity. thank you

public class mysearchableactivity extends actionbaractivity {     requestqueue requestqueue;     list<numberresults> storieslist = new arraylist<>();     private recyclerview recycle;       private toolbar toolbar;     final context context = this;      //  @override     //protected void oncreate(bundle savedinstancestate)     public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {          //super.oncreate(savedinstancestate);         // setcontentview(r.layout.fragment_numbers);          toolbar = (toolbar) findviewbyid(r.id.app_bar);         setsupportactionbar(toolbar);          log.i(tag, "in mysearchableactivity");           view layout = inflater.inflate(r.layout.fragment_numbers, container, false);         recycle = (recyclerview) layout.findviewbyid(r.id.drawrlist);         recycle.setlayoutmanager(new linearlayoutmanager(this));         recycle.sethasfixedsize(true);           intent intent = getintent();         handleintent(intent);          return layout;     }      private void handleintent(intent intent) {         // query out of intent         if (intent.action_search.equals(intent.getaction())) {             string searchquery = intent.getstringextra(searchmanager.query);             dosearchquery(searchquery);         }     }      @override     protected void onnewintent(intent intent) {         log.i(tag, "in onnewintent");         setintent(intent);         handleintent(intent);     }      private void dosearchquery(string query) {           final numadapters rvadapter = new numadapters(storieslist);         recycle.setadapter(rvadapter);           requestqueue = volley.newrequestqueue(this);         string url = "http://webserver.com/searchablewho.php?owner=" + query;           jsonarrayrequest jsonarrayrequest = new jsonarrayrequest(url, new response.listener<jsonarray>() {             @override             public void onresponse(jsonarray response) {                 try {                     if (response.length() > 0) {                         storieslist.clear();                         (int = 0; < response.length(); i++) {                             jsonobject jsonobject = response.getjsonobject(i);                             numberresults stories = new numberresults();                              if (!jsonobject.isnull("number")) {                                 stories.name = jsonobject.getstring("number");                             }                             if (!jsonobject.isnull("owner")) {                                   stories.age = jsonobject.getstring("owner");                                 }                             storieslist.add(i, stories);                         }                         rvadapter.notifydatasetchanged();                     }                 } catch (jsonexception e) {                     e.printstacktrace();                 }             }         }, new response.errorlistener() {             @override             public void onerrorresponse(volleyerror error) {                 //             }         });          requestqueue.add(jsonarrayrequest);      } 

you extending actionbaractivity instead of fragment. why method oncreateview never called.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -