Android RetroFit Refresh list -


i'm pretty new retrofit. i'd refresh list when activity goes onresume. scenario this, i'm in activity has list (retrofit), user clicks on button redirect activity b. after activity b closed, list in activity should refreshed. how can achieve that?

this i've tried far:

                restadapter restadapter = new restadapter.builder()                     .setendpoint(constants.url_get_all_records)                     .setrequestinterceptor(requestinterceptor)                     .setloglevel(restadapter.loglevel.full)                     .build();                  recordsapi api = restadapter.create(recordsapi.class);                 api.getrecords(new callback<list<record>>() {                     @override                     public void failure(retrofiterror arg0) {                     }                      @override                     public void success(list<record> list, response response) {                          recordlist = list;                          recordadapter =                                 new displayadapter(activity,                                         r.layout.simple_spinner_item, recordlist);                          spinner.setadapter(recordadapter);                          if (recordadapter.getcount() == 0) {                             lactionbuttons.setvisibility(view.gone);                             layout.setvisibility(view.visible);                             tvnotice.settext("no records found");                              button.setonclicklistener(new onclicklistener() {                                 @override                                 public void onclick(view v) {                                     intent = new intent(activity, activityb.class);                                     activity.startactivity(i);                                 }                             });                          } else {                             tvnotice.setvisibility(view.gone);                             spinner.setonitemselectedlistener(new onitemselectedlistener() {                                 @override                                 public void onitemselected(adapterview<?> parent, view v,                                                            int pos, long id) {                                 }                                  @override                                 public void onnothingselected(adapterview<?> parent) {                                 }                             });                          }                       }                 }); 

any ideas how refresh list? gladly appreciate kind of help. thanks!


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -