android中UI中的Context如何传递给非UI类??

解决方案 »

  1.   

    非UI类的 构造函数中传入 context 变量。如:public class AppInfo {
        private int mThumbId;
        private Bitmap mThumb;
        private Context mContext;    public AppInfo(Context context, int thumbId) {
            mContext = context;
            mThumbId = thumbId;
            mThumb = BitmapFactory.decodeResource(context.getResources(), mThumbId);
        }}
      

  2.   

    LZ参考一下这个帖子,总结的很全面
    http://topic.csdn.net/u/20110215/21/12f944f5-83e3-4f98-aff7-5e0a1212d8ab.html