我收到了一个好的回复,我可以在我的视图上显示模型属性,除了一个图像列表。虽然我看到日志中有所需的JSON数据,但我从中得到了一个空值。由于它是一个图像列表,我使用Glide来显示它们,并在日志上显示
W/Glide: Load failed for null with size [0x0] class com.bumptech.glide.load.engine.GlideException: Received null model
我试图访问的属性是
promotionalimages
在课堂上
Data
.
如果需要进一步的信息请告诉我。
我做错什么了?
型号:
RestaurantModel
我的活动的一部分,其中im显示响应:
Call<RestaurantModel> call = apiInterface.getRestaurant(getSharedPreference.getToken(), identifier);
call.enqueue(new Callback<RestaurantModel>() {
@Override
public void onResponse(@NonNull Call<RestaurantModel> call, @NonNull Response<RestaurantModel> response) {
restaurant = response.body();
rName.setText(restaurant.getData().getName());
ratingtxt.setText(String.format("%s", restaurant.getData().getAvgRatingCount()));
Glide.with(context).load(restaurant.getData().getPromotionalimages().get(0).getPromotionalPicture()).apply(RequestOptions.centerCropTransform().placeholder(R.drawable.default_image)).into(holder.image);
回应:
{
"data": {
"identifier": "0464eee2-5160-40e7-8ae0-77e7484fe251",
"name": "Apple Lab",
"phonenumber": "11116425300",
"start_time": "7:00 AM",
"end_time": "1:00 PM",
"created_at": "2018-07-30 20:10:05",
"updated_at": "2018-07-30 20:11:00",
"reviews_count": 0,
"avgRatingCount": 0,
"categoryCount": 0,
"subCategoryCount": 0,
"totalItemCount": 0,
"availableItemCount": 0,
"isOpen": 1,
"logo": "https://x.co/storage/logoandcover/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1dc0ef064.png",
"cover": "https://x.co/storage/logoandcover/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1df0e2f78.png",
"galleryimages": [
{
"id": 6,
"identifier": "0464eee2-5160-40e7-8ae0-77e7484fe2511",
"restaurant_id": 7,
"gallery_picture": "https://x.co/storage/galleryimages/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1e2cc80aa.png",
"created_at": "2018-07-30 20:18:20",
"updated_at": "2018-07-30 20:18:20"
}
],
"location": {
"house": "x",
"road": "x",
"details": "x",
"country": "x",
"created_at": "2018-07-30 20:12:28",
"updated_at": "2018-07-30 20:12:28",
"cityName": "x",
"areaName": "x"
},
"promotionalimages": [
{
"id": 10,
"identifier": "0464eee2-5160-40e7-8ae0-77e7484fe2511",
"restaurant_id": 7,
"promotional_picture": "https://x.co/storage/promotionalimages/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1ec0afffb.png",
"created_at": "2018-07-30 20:20:48",
"updated_at": "2018-07-30 20:20:48"
},
{
"id": 11,
"identifier": "0464eee2-5160-40e7-8ae0-77e7484fe2512",
"restaurant_id": 7,
"promotional_picture": "https://x.co/storage/promotionalimages/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1ec13a9b7.png",
"created_at": "2018-07-30 20:20:49",
"updated_at": "2018-07-30 20:20:49"
}
],
"features": [
{
"id": 25,
"restaurant_id": 7,
"name": "Food Quality",
"created_at": "2018-07-30 20:11:00",
"updated_at": "2018-07-30 20:11:00",
"favoritesCount": 0,
"isFavorited": false,
"favorites": []
},
{
"id": 26,
"restaurant_id": 7,
"name": "Customer Service",
"created_at": "2018-07-30 20:11:00",
"updated_at": "2018-07-30 20:11:00",
"favoritesCount": 0,
"isFavorited": false,
"favorites": []
},
{
"id": 27,
"restaurant_id": 7,
"name": "Environment",
"created_at": "2018-07-30 20:11:00",
"updated_at": "2018-07-30 20:11:00",
"favoritesCount": 0,
"isFavorited": false,
"favorites": []
},
{
"id": 28,
"restaurant_id": 7,
"name": "Food Pricing",
"created_at": "2018-07-30 20:11:00",
"updated_at": "2018-07-30 20:11:00",
"favoritesCount": 0,
"isFavorited": false,
"favorites": []
}
],
"reviews": [],
"categories": [],
"menus": [],
"profile": {
"id": 7,
"restaurant_id": 7,
"logo": "https://x.co/storage/logoandcover/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1dc0ef064.png",
"cover": "https://x.co/storage/logoandcover/0464eee2-5160-40e7-8ae0-77e7484fe251/15b5f1df0e2f78.png",
"payable_amount": "0.00",
"payment_received": "0.00",
"last_paid": "2018-07-30 14:17:21",
"score": "100.00",
"vat_reg_number": null,
"created_at": "2018-07-30 20:11:00",
"updated_at": "2018-07-30 20:17:21",
"status": "Bronze"
}}}
非常感谢你抽出时间。