Use Picasso in listview

I need help with connecting picasso to listview, do not know how to do this, picasso connected and it works, but the fact that one was already in another problem. The list must be of a picture, and then all that has been done (checkbox and text). Due to the fact that I'm a novice, I do not know what to do for it. I will be glad if you could help me with this! Thank you in advance!

listview part

    final String[] productnames = {
            "Type 1", "Type 2", "Type 3" };
    selection = (EditText) findViewById(R.id.aboutform);
    listView = (ListView) findViewById(R.id.productlist);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_multiple_choice, productnames);
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v,
                                int position, long id) {
            // TODO Auto-generated method stub
            selection.setText("");
            SparseBooleanArray chosen = ((ListView) parent).getCheckedItemPositions();
            for (int i = 0; i < chosen.size(); i++) {
                if (chosen.valueAt(i)) {
                    selection.append(productnames [chosen.keyAt(i)] + " ");
                }
            }
        }
    });

Upvotes: 1

Views: 374

Answers (3)

user6309365
user6309365

Reputation:

You can use url instead of drawable image in load

Picasso.with(mContext).load("https://s3om/foodev/hotel/" + imageLocation).placeholder(R.drawable.ic_default_hotel).error(R.drawable.ic_default_hotel).into(holder.imageviewHotel);

Upvotes: 1

Manish
Manish

Reputation: 353

here is the example of custom listview

hope it will help you

Upvotes: 0

Manish
Manish

Reputation: 353

    Picasso.with(ctx).load(imgPath).fit().into(viewHolder.imageView);

Upvotes: 1

Related Questions