【Android studio开发】
public void updateBingPic() {
String requestBingPic = "http://guolin.tech/api/bing_pic";
OkHttp.sendRequestOkHttpForGet(requestBingPic, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String bingPic = response.body().string();
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(WeatherActivity.this).edit();
editor.putString("bing_pic", bingPic);
editor.apply();
}
});
}
评论