Reputation: 139
I am using retrofit in my android application but my service sometimes return object data type and sometime array datatype. how can i handle this ? i used object in place of data type in android but am not able to use it properly.
Upvotes: 1
Views: 333
Reputation: 686
Create an Interface,inside the Interface whenever your service returns a List do like this:
public Interface EndPointInterface{
@GET(Constants.URL_GET_PHARMACY_REPORT)
Call<List<PharmacyReport>> getPharmacyReport(@Query(Constants.PATIENT_ID) String patientId);
}
else if your service returns an Object proceed like this:
public Interface EndPointInterface{
@GET(Constants.URL_FETCH_STORE_INFO)
Call<Store> getStoreInfoByBeaconUUID(@Query(Constants.BEACON_UUID) String beaconUUID);
}
Upvotes: 1