I'm currently parsing a web file then setting 5 textview values upon completion, however, every time the activity is closed and reopened it needs to yet again access the page parse and display the values, how can i prevent it from having to?
It should noted that the data changes quite regularly so i cant simply SAVE the values forever.
public void gatherStockDetails(String symb) {
AsyncHttpClient client = new AsyncHttpClient();
client.get("url" + symb + "&f=snpog",
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
Log.e("KFF-a", response);
stockinfo = response.split(",");
setTextViews(stockinfo[0].replaceAll("[^a-zA-Z0-9.%+ -]+", ""),
stockinfo[1].replaceAll("[^a-zA-Z0-9.%+ -]+", ""),
stockinfo[2].replaceAll("[^a-zA-Z0-9.%+ -]+", ""),
stockinfo[3].replaceAll("[^a-zA-Z0-9.%+ -]+", ""),
stockinfo[4].replaceAll("[^a-zA-Z0-9.%+ -]+", ""));
}
@Override
public void onFailure(Throwable arg0, String arg1) {
super.onFailure(arg0, arg1);
}
});
}
and
public void setTextViews(String Symbol, String Name, String PClose, String Open, String Low) {
final Animation in = new AlphaAnimation(0.0f, 1.0f);
in.setDuration(500);
tvName.setText(Name.replace("Corpora", "Corporation"));
tvName.startAnimation(in);
tvSymbol.setText(Symbol);
tvSymbol.startAnimation(in);
tvSymbol.setText(PClose);
tvPClose.startAnimation(in);
tvLow.setText(Low);
tvLow.startAnimation(in);
tvOpen.setText(Open);
tvOpen.startAnimation(in);
}
Sorry, i did not mention, this is in a Fragment on an activity, thus there is no onRestoreInstance state.