@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getString();
}
private void getString(){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(URL_MOVIE)
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
res_120 = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
updateUI(res_120);
}
});
}
});
}
void updateUI(String string) {
textView.setText(string);
}
How do i save the textView text on screen rotation ? Every time i rotate the screen a new string is retrieved from the response and the my textView text changes. how stop that from happening i want to make sure that same string remains on the textview during screen rotation until and unless i update it myself by calling the getString method on say any onclicklistener to get another string for the textview.