Skip to content Skip to sidebar Skip to footer

New Thread While Loading Listview In A Fragment

I have an Activity, which holds a TabHolder. Every tab its a Fragment. One of the tabs, has a ListView, which should be fulfilled with photos, and text. The problem is, when I tap

Solution 1:

A. Don't set any views on a thread that isn't the UI thread (as u did).

B. Use Picasso for image loading or some other lib, don't reinvent the wheel. The lib will do all of the loading on back thread therefore you wouldn't need any progressbar (probably).

Follow those two steps and your code should work fine.

Edit: The issue is your path probably, I've used picasso to load urls not from inner storage. Print your path and take a look.

Solution 2:

In case someone is trying to load images from the device, and is facing the same problem that me, this is the correct syntax to use Picasso with that images:

Picasso.with(c).load(new File(path).resize(80, 80).into(holder.foto);

Post a Comment for "New Thread While Loading Listview In A Fragment"