Fetch json data on a remote server instead of local json
Closed this issue · 1 comments
Mabudigital commented
I have my data JSON on a remote server. How can that data be fetched from a remote server instead of local data.json?
islem19 commented
Check the Remote Manager.java , the method below fetchData(), retreive the data from the local resources RAW , you should override or modify the function to fetch the data from a remote service (check usage of retrofit lib)
public void featchData(){
Log.e("TAG", "featchData: " );
String json = Utils.inputStreamToString(mContext.getResources().openRawResource(
R.raw.data));
LocalData dataRow = new Gson().fromJson(json, LocalData.class);
mFragment.notifyOnTvDataAvailable(dataRow.getTv());
mFragment.notifyOnRadioDataAvailable(dataRow.getRadio());
}
`