从其他存储文件服务器检索图像

时间:2018-07-31 02:29:56

标签: android android-recyclerview recyclerview-layout

Adapter.java

它工作正常,但是图像无法显示,如果我在数据库中放置新的url图像,该图像肯定会显示..我已经连接到数据库了。.

public class Adapter extends RecyclerView.Adapter<Adapter.CustomerViewHolder> {

    private Context mCtx;
    private List<Customer> customerList;
    String image_url = "https://192.168.54.223/xms/storage/";
       //path of the image


    public Adapter(Context mCtx, List<Customer> customerList){
        this.mCtx = mCtx;
        this.customerList = customerList;
    }

    @Override
    public CustomerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(mCtx);
        View view = inflater.inflate(R.layout.list_layout,null);
        return new CustomerViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final CustomerViewHolder holder, int position) {
        final Customer customer = customerList.get(position);
            Glide.with(mCtx)
                    .load(customer.getImage())
                    .into(holder.imageView);//is this correct or not?

0 个答案:

没有答案