androidadaptergetview

Adapter getView() method is not accessed


This is my adapter:

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;
    }  

This is what I get in the 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  

I tried all the answers given in Stackoverflow but none of them seems to solve my problem.


Solution

  • Try this

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
    
            gamblingVideoAdapter = new GamblingVideoAdapter(GamblingVideosActivity.this, videosBeans);
            lvGamblingVideos.setAdapter(gamblingVideoAdapter);
    
        }
    });