我有一个产品列表,从web服务检索到。当应用程序首次打开时,应用程序会从web服务获取产品列表。我想将此列表保存到共享偏好中。
List<Product> medicineList = new ArrayList<Product>();
Product类定义如下:
public class Product {
public final String productName;
public final String price;
public final String content;
public final String imageUrl;
public Product(String productName, String price, String content, String imageUrl) {
this.productName = productName;
this.price = price;
this.content = content;
this.imageUrl = imageUrl;
}
}
我该如何保存这个List,而不需要每次都从Web服务请求?