所以我已经坚持了几个小时。我正在尝试设置一个异步任务,该任务将在另一个类中为我的列表视图加载图像,并且我正在传递给我错误的信息
任何帮助,将不胜感激!
公共类 TheResults 扩展 Activity {
public static final String DEFAULTNAME = "DefaultFile";
private GETTHEIMAGE imgFetch;
private ArrayList<Item_Info> Info = new ArrayList<Item_Info>();
String Data = null;
String THESTRING = null;
TextView httpStuff;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// full screen
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.theresults);
SharedPreferences Search = getSharedPreferences(DEFAULTNAME, 0);
Data = Search.getString("THERESULTS", null);
GetINFO();
populatelist();
}
private void GetINFO() {
}
}
}
private void populatelist() {
ArrayAdapter<Item_Info> adapter = new TheListAdapter();
ListView list = (ListView) findViewById(R.id.listings);
list.findFocus();
list.getWindowToken();
list.setAdapter(adapter);
}
public class TheListAdapter extends ArrayAdapter<Item_Info> {
public TheListAdapter() {
super(TheResults.this, R.layout.items, Info);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View item_View = convertView;
ImageHolder holder = null;
if (item_View == null) {
item_View = getLayoutInflater().inflate(R.layout.items, parent, false);
Item_Info CurrentItem = Info.get(position);
holder = new ImageHolder();
holder.ICON_IMG = (ImageView)item_View.findViewById(R.id.icon_image);
holder.ICON_IMG.setTag(CurrentItem.getItemPIC());
Drawable MYIMG = imgFetch.GetTheImagedata(this, holder.ICON_IMG);
holder.ICON_TITLE = (TextView)item_View.findViewById(R.id.icon_title);
holder.ICON_TITLE.setText(CurrentItem.getItemTITLE());
holder.ICON_LOCATION = (TextView)item_View.findViewById(R.id.icon_location);
holder.ICON_LOCATION.setText(CurrentItem.getItemLOCATION());
holder.ICON_PRICE = (TextView)item_View.findViewById(R.id.icon_price);
if (CurrentItem.getItemPRICE() == null) {
holder.ICON_PRICE.setText(CurrentItem.getItemPRICE());
holder.ICON_PRICE.setBackgroundResource(R.drawable.tempbg);
} else {
holder.ICON_PRICE.setBackgroundResource(R.drawable.pricebg);
holder.ICON_PRICE.setText(CurrentItem.getItemPRICE());
}
holder.ICON_DATE = (TextView)item_View.findViewById(R.id.icon_date);
holder.ICON_DATE.setText(CurrentItem.getItemLOCATION());
}else{
holder = (ImageHolder)item_View.getTag();
}
return item_View;
}
}
static class ImageHolder{
ImageView ICON_IMG;
TextView ICON_TITLE;
TextView ICON_LOCATION;
TextView ICON_PRICE;
TextView ICON_DATE;
}
}