未访问适配器 getView() 方法
Adapter getView() method is not accessed
这是我的适配器:
public GamblingVideoAdapter(Context context, ArrayList<GamblingVideosBean> gamblingVideosBeans) {
this.context = context;
this.gamblingVideosBeans = gamblingVideosBeans;
Log.d("===GamblingVideoAdapter", "adaper text : " + gamblingVideosBeans.size());
}
@Override
public int getCount() {
return gamblingVideosBeans.size();
}
@Override
public Object getItem(int position) {
return gamblingVideosBeans.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Log.d("===gambling", "adapter hi kevin");
return null;
}
这是我在 logcat 中得到的:
10-05 19:09:20.118 5925-5925/com.sb.android.acg.test I/Ads: Scheduling ad refresh 60000 milliseconds from now.
10-05 19:09:20.386 5925-7768/com.sb.android.acg.test D/===GamblingVideoAdapter: adaper text : 50
我尝试了 Whosebug 中给出的所有答案,但其中 none 似乎解决了我的问题。
试试这个
runOnUiThread(new Runnable() {
@Override
public void run() {
gamblingVideoAdapter = new GamblingVideoAdapter(GamblingVideosActivity.this, videosBeans);
lvGamblingVideos.setAdapter(gamblingVideoAdapter);
}
});
这是我的适配器:
public GamblingVideoAdapter(Context context, ArrayList<GamblingVideosBean> gamblingVideosBeans) {
this.context = context;
this.gamblingVideosBeans = gamblingVideosBeans;
Log.d("===GamblingVideoAdapter", "adaper text : " + gamblingVideosBeans.size());
}
@Override
public int getCount() {
return gamblingVideosBeans.size();
}
@Override
public Object getItem(int position) {
return gamblingVideosBeans.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Log.d("===gambling", "adapter hi kevin");
return null;
}
这是我在 logcat 中得到的:
10-05 19:09:20.118 5925-5925/com.sb.android.acg.test I/Ads: Scheduling ad refresh 60000 milliseconds from now.
10-05 19:09:20.386 5925-7768/com.sb.android.acg.test D/===GamblingVideoAdapter: adaper text : 50
我尝试了 Whosebug 中给出的所有答案,但其中 none 似乎解决了我的问题。
试试这个
runOnUiThread(new Runnable() {
@Override
public void run() {
gamblingVideoAdapter = new GamblingVideoAdapter(GamblingVideosActivity.this, videosBeans);
lvGamblingVideos.setAdapter(gamblingVideoAdapter);
}
});