0

I am trying to load multiple images with picasso in customadapter.

public CustomListAdapter(Activity activity,String[] planet,String[] images_url){

    super(activity,R.layout.simplerow,planet);

    this.activity=activity;
    this.planet=planet;
    this.images_url=images_url;

   }

public View getView(int position,View view,ViewGroup parent){

    LayoutInflater inflater=activity.getLayoutInflater();
    View rowView=inflater.inflate(R.layout.simplerow, null, true);

    TextView txtName=(TextView)rowView.findViewById(R.id.rowTextView);
    ImageView imageView=(ImageView)rowView.findViewById(R.id.img2);

    txtName.setText(planet[position]);
    Picasso.with(activity).load(images_url[position]).into(imageView);

    return rowView;
}

Below is how I am calling. It works fine showing list of planet name but w/o images.

String[] planets = new String[] { "Mercury", "Venus", "Earth"};
String[] images_url = new String[]{
    "http://i.imgur.com/DvpvklR.png","http://i.imgur.com/XjpMiHR.png","http://i.imgur.com/9fGn1PX.png%22"
};

String string_array_dat[]=new String[hold_data.size()];
string_array_dat=hold_data.toArray(string_array_dat);
//   CustomListAdapter 
CustomListAdapter customadpt = new CustomListAdapter(activity,planets,images_url);

ListView lstview=(ListView)findViewById(R.id.mainListView);
lstview.setAdapter(customadpt);

My logcat shows below errors:

10-07 02:16:17.599  30112-30112/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
10-07 02:16:17.599  30112-30112/? E/android.os.Debug﹕ failed to load memtrack module: -2
10-07 02:16:31.429    1161-1295/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
Ramiz Wachtler
  • 5,623
  • 2
  • 28
  • 33
  • can you post the full stack trace of your error? – Randyka Yudhistira Oct 07 '15 at 06:40
  • That doesn't look like a Picasso error (from what I remember about memory issues). What does your simplerow layout look like? Mostly, what are the width and height? – wblaschko Oct 07 '15 at 06:45
  • Make sure Internet permission is added in Manifest. Try your app in a real device if you are using a emulator – Jithin Sunny Oct 07 '15 at 06:51
  • @wblaschko i have given both width and height with wrap content as well as fill parent. It show empty space below each text. – Basim Khan Oct 07 '15 at 07:04
  • @Sunny yes, I added that already. I also tried it on device – Basim Khan Oct 07 '15 at 07:05
  • plz read this http://stackoverflow.com/questions/22629568/couldnt-load-memtrack-module-logcat-error – Mohit Suthar Oct 07 '15 at 07:16
  • Everything seems to be correct in your code, I have tried. So issue may be related to sound settings in your device. Refer this link http://stackoverflow.com/questions/23180638/how-fix-this-on-logcat-error-loading-system-media-audio-ui-effect-tick-og – Prasad Oct 07 '15 at 08:24

1 Answers1

0

The solution for my question is by changing below code:

 View rowView=inflater.inflate(R.layout.simplerow,parent,false);
Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51