我正在使用它将一些字符串设置为列表..
private String[] mImageURLs = {
urlImage1,
urlImage2,urlImage3,urlImage4,urlImage5,urlImage6,urlImage7};
在这里我将它们传递给适配器
adapter=new LazyAdapter(MainMenu.this, mImageURLS};
我从远程文本文档中检索URL。我system.out每一个,以确保URL字符串不为空。
但由于某种原因,他们在我的适配器类中返回null ..
public class LazyAdapter extends BaseAdapter {
private Activity activity;
private String[] data;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public LazyAdapter(Activity a, String[] d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return data.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.lazyitemt, null);
ImageView image=(ImageView)vi.findViewById(R.id.imageView);
image.setLayoutParams(new LinearLayout.LayoutParams(250, 250));
imageLoader.DisplayImage(data[position], activity, image);
Log.e("LAZY", data[position]);
return vi;
}
}
当我记录数据时,它说println需要一条消息。
我不明白为什么这样做!很明显,弦乐就在那里!
有谁知道为什么或有任何建议?