android - avoid unnecessary volley requests on orientation change -


i have android app i'm displaying results restfull webservice in activity recyclerview (wrapped in swiperefreshlayout). in oncreate set adapter etc. , start request volley. when change orientation of device same request started.

how can prevent app unnecessary web requests on orientation change?

i mean data loaded no request necessary.

edit: try in avoiding requests, after change of orientation there still requests:

private arraylist<item> mdataset;  protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //... if (mdataset== null){ mdataset = new arraylist<>(); }  if (mdataset.size() == 0) { startrequest(); } //... } 

you can try using loader works in background , survives orientation change.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -