android - Picasso IllegalArgumentException -


i'm trying use picasso load facebook photos listview.

i'm getting "java.lang.illegalargumentexception: target must not null"

on line:

.into(holder.userpicture); 

if userpicture imageview 'target', don't understand. guess has adapter, can't figure out what.

all appreciated!

edit

i found problem. made careless mistake. on line, forgot convertview part:

holder.userpicture=(imageview)findviewbyid(r.id.userpicture); 

logcat:

06-01 16:37:14.392: e/androidruntime(7885): java.lang.illegalargumentexception: target must not null. 06-01 16:37:14.392: e/androidruntime(7885):     @ com.squareup.picasso.requestcreator.into(requestcreator.java:479) 06-01 16:37:14.392: e/androidruntime(7885):     @ com.squareup.picasso.requestcreator.into(requestcreator.java:462) 06-01 16:37:14.392: e/androidruntime(7885):     @ com.example.mywebsite.allproductsactivity$myadapter.getview(allproductsactivity.java:327) 

myadapter:

public class myadapter extends arrayadapter<hashmap<string, string>> {      context context;     int resourceid;     layoutinflater inflater;     private context mcontext;       arraylist<hashmap<string, string>>  items;     public myadapter (context context, int resourceid, arraylist<hashmap<string, string>> items)     {         super(context, resourceid, items);         mcontext = context;         this.items =items;         inflater = (layoutinflater)context.getsystemservice(context.layout_inflater_service);     }      @override     public view getview(int position, view convertview, viewgroup parent){         final viewholder holder;         if (convertview == null){              convertview = inflater.inflate(r.layout.list_item, null);              holder = new viewholder();             holder.name = (textview)convertview.findviewbyid(r.id.name);             holder.userpicture=(imageview)findviewbyid(r.id.userpicture);             convertview.settag(holder);          } else {              holder = (viewholder)convertview.gettag();         }          hashmap<string,string> item = (hashmap<string,string> ) items.get(position);         if (item != null)         {              string facebookprofilepicurl = "http://graph.facebook.com/"+tag_facebookid+"/picture?width=100&height=100";             picasso.with(mcontext).load(facebookprofilepicurl) .into(holder.userpicture);              holder.name.settext(item.get(tag_facebookid));           }          return convertview;     }      public class viewholder     {         textview    name;         imageview userpicture;     } } 

presumably, holder.userpicture null. either res/layout/list_item not have widget named userpicture, or need clean project (e.g., project > clean eclipse main menu).

also, please use three-parameter version of inflate(), not run problems if change row layout use relativelayout root.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -