小编Tus*_*zan的帖子

片段:尝试在空对象引用上调用虚拟方法“android.view.View android.view.View.findViewById(int)”

我正在尝试插入从我的 SQLite 数据库填充的 GridView,但出现错误

“尝试在空对象引用上调用虚拟方法 'android.view.View android.view.View.findViewById(int)'”

MyAdapter.java

public class MyAdapter extends BaseAdapter {
Context context;
ArrayList<Players> playerList;
private static LayoutInflater inflater = null;

public MyAdapter(Context context, ArrayList<Players> playerList){
    this.context = context;
    this.playerList = playerList;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}


@Override
public int getCount() {
    return playerList.size();
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == …
Run Code Online (Sandbox Code Playgroud)

java sqlite android gridview adapter

1
推荐指数
1
解决办法
7057
查看次数

标签 统计

adapter ×1

android ×1

gridview ×1

java ×1

sqlite ×1