空指针异常
getView方法中,判断view是否为空时一直报空指针异常,对了一遍代码,没问题啊
public View getView(int position, View view, ViewGroup viewGroup) {
WordButton holder;
if (view == null) {
view = LayoutInflater.from(mContext).inflate(R.layout.gridview_item, null);
holder = (WordButton) getItem(position);
holder.mIndex = position;
holder.mBtnWord = (Button) findViewById(R.id.id_btn_word);
view.setTag(holder);
} else {
holder = (WordButton) view.getTag();
}
holder.mBtnWord.setText(holder.mStrWord);
return view;
}