LayoutInflater inflater = (LayoutInflater) context
.getSystemService(context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.home_select_list, null);
这行报空指针,可能原因为,这个适配器调用构造函数实例化时:
public DesignAdapter(Context context, int resource, int textViewResourceId,
Object[] objects) {
super(context, resource, textViewResourceId, objects);
// TODO Auto-generated constructor stub
context = context;
}
context前没有加this, 类变量context并没有赋值 这样导致LayoutInflater实例化时报空指针。
解决办法:
public DesignAdapter(Context context, int resource, int textViewResourceId,
Object[] objects) {
super(context, resource, textViewResourceId, objects);
// TODO Auto-generated constructor stub
this.context = context;
}