I have a GridView with two columns and I want to show a native ad after every n-th row. I have searched a lot on the internet but couldn't find any solution.

I have tried a few libraries/sdks like <https://github.com/clockbyte/admobadapter> but have been unable to solve my problem.

Code Try:

```
public View getView(final int position, View row, ViewGroup parent) {
        MyHolder holder = null;
        boolean showAd = proVersion == false && (position % 8 == k);
        if (showAd) {
            AdView adView = adList.get(position);
            if (adView == null) {
                AdView adViewNew = new AdView((Activity) context, AdSize.BANNER, context.getResources().getString(
                        R.string.adId));
                adViewNew.loadAd(Utils.getAdRequest("gps", lat, lng, keywords));
                adList.add(position, adViewNew);
                return adViewNew;
            } else {
                return adView;
            }
        } else if (row == null || row instanceof AdView) {
            LayoutInflater inflater = ((SherlockActivity) context).getLayoutInflater();
            row = inflater.inflate(viewResourceId, parent, false);
            holder = new MyHolder();
            holder.textName = (TextView) row.findViewById(R.id.name);
            row.setTag(holder);
        } else {
            holder = (MyHolder) row.getTag();
        }
        holder.textName.setText(items.get(position).getName());

        // more code

        return row;
    }

```

[I want to achieve something like this:](https://i.stack.imgur.com/Mkd8f.jpg)