用户信息通过SOAP服务传递到Flex应用程序,并显示特定用户的头像。但是,当应用程序运行时,不会显示任图像的路径在一个数组中,它被分配给图像源但不能真正起作用。另一方面,当我像链接本身一样给它时它起作用。
List<object> objlist = dataModel.Value
.Cast<object>() // every item will be cast to object
.ToList(); // then make a new list out of it, this is type safe as the original List<whatever> is not affected.
我也可以在正确的时候获得正确的链接;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout. list);
listview=(ListView)findViewById(R.id. List1);
dbhandler=new DBHandler(this);
refno = new ArrayList<String>();
names = new ArrayList<String>();
status=new ArrayList<String>();
allDetails = new ArrayList<String>();
List=dbhandler.getAllList();
for(int i=0; i< List.size(); i++){
refno.add(List.get(i).getrefno());
names.add(List.get(i).getname());
status.add(List.get(i).getstatus());
}
for(int i=0; i<refno.size(); i++){
allDetails.add(refno.get(i) + " - " + names.get(i) + " - " + " - " + status.get(i));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, allDetails);
listview.setAdapter(adapter);
}
如何显示保存在该阵列中的用户的头像?
答案 0 :(得分:1)
尝试将Info.repStuArr[Info._StuList].avatar
转换为字符串并将该字符串应用于stu_avatar.source
像:
var str:String = Info.repStuArr[Info._StuList].avatar;
stu_avatar.source = str;
或尝试:
stu_avatar.source = (Info.repStuArr[Info._StuList].avatar).toString();