从我的主要活动中,我想将ImageView
传递给另一个类的构造函数,或者如果需要,可以将此类的对象传递给另一个类的构造函数。一些代码在下面。将ImageView传递给构造函数
类情况:
public class Case {
String id;
int status;
Date date;
ImageView orginalFace;
ImageView profilePicture;
public Case(String id, int status, Date date, ImageView orginalFace, ImageView profilePicture) {
this.id= id;
this.status = status;
this.date = date;
this.orginalFace= orginalFace;
this.profilePicture= profilePicture;
}
}
而这正是我尝试添加的ImageView:
ArrayList<Case> cases = new ArrayList<Case>();
Case case1 = new Case("991176565809", 1, new Date(), R.drawable.face, R.drawable.profile);
我知道,当我尝试添加R.drawable.face
和R.drawable.profile
这只是integers
。我如何能够正确地做到这一点?
其实你想要做到这一点? – user370305
这仅用于测试目的。其实图像应该来自web服务。 –
这取决于您的实际需求,如果图像来自WebService,那么最好使用Bitmap而不是ImageView。 – user370305