android:在类中使用image作为属性

时间:2014-08-12 11:19:04

标签: android image class

//我的代码就像:

enum Quality{
    usable, clean, dirty, inevitable;
}

public class Wc {
    public String address;
    public Image image;
    public Quality quality;

public Wc(String st,Image im,Quality q){
    address=st;
    image=im;
    quality=q;

}
}

//我应该如何使用构造函数或为其提供图像路径?

1 个答案:

答案 0 :(得分:0)

public myClass extends Activity{
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       Bitmap image1 = BitmapFactory.decodeResource(this.getResources(),
        R.drawable.image1);
       Wc wc = new Wc(yourString,image1, yourQuality);
   }
}