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
Post a Comment