private void initListViewItems() {
    """
	Inits an adapter with items, wrapping your adapter with a {@link AdmobAdapterWrapper} and setting the listview to this wrapper
	FIRST OF ALL Please notice that the following code will work on a real devices but emulator!
    """
        lvMessages = (ListView) findViewById(R.id.lvMessages);

        //creating your adapter, it could be a custom adapter as well
        ArrayAdapter<String> adapter  = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1);

        //your test devices' ids
        String[] testDevicesIds = new String[]{getString(R.string.testDeviceID),AdRequest.DEVICE_ID_EMULATOR};
        //when you'll be ready for release please use another ctor with admobReleaseUnitId instead.
        adapterWrapper = new AdmobAdapterWrapper(this, testDevicesIds);
        //By default both types of ads are loaded by wrapper.
        // To set which of them to show in the list you should use an appropriate ctor
        //adapterWrapper = new AdmobAdapterWrapper(this, testDevicesIds, EnumSet.of(EAdType.ADVANCED_INSTALLAPP));

        //wrapping your adapter with a AdmobAdapterWrapper.
        adapterWrapper.setAdapter(adapter);
        //inject your custom layout and strategy of binding for installapp/content  ads
        //here you should pass the extended NativeAdLayoutContext
        //by default it has a value InstallAppAdLayoutContext.getDefault()
        //adapterWrapper.setInstallAdsLayoutContext(...);
        //by default it has a value ContentAdLayoutContext.getDefault()
        //adapterWrapper.setContentAdsLayoutContext(...);

        //Sets the max count of ad blocks per dataset, by default it equals to 3 (according to the Admob's policies and rules)
        adapterWrapper.setLimitOfAds(3);

        //Sets the number of your data items between ad blocks, by default it equals to 10.
        //You should set it according to the Admob's policies and rules which says not to
        //display more than one ad block at the visible part of the screen,
        // so you should choose this parameter carefully and according to your item's height and screen resolution of a target devices
        adapterWrapper.setNoOfDataBetweenAds(10);

        adapterWrapper.setFirstAdIndex(2);

        lvMessages.setAdapter(adapterWrapper); // setting an AdmobAdapterWrapper to a ListView
        lvMessages.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                final AdmobAdapterCalculator adapterCalc = adapterWrapper.getAdapterCalculator();
                int fetchedAdsCnt = adapterWrapper.getFetchedAdsCount();
                int sourceCnt = adapterWrapper.getAdapter().getCount();
                int originalPos = adapterCalc.getOriginalContentPosition(position, fetchedAdsCnt, sourceCnt);
                Toast.makeText(getApplicationContext(),
                        "Click: " + String.valueOf(originalPos),
                        Toast.LENGTH_SHORT).show();
            }
        });

        //preparing the collection of data
        final String sItem = "item #";
        ArrayList<String> lst = new ArrayList<String>(100);
        for(int i=1;i<=100;i++)
            lst.add(sItem.concat(Integer.toString(i)));

        //adding a collection of data to your adapter and rising the data set changed event
        adapter.addAll(lst);
        adapter.notifyDataSetChanged();
    }
private void initListViewItems() {
        lvMessages = (ListView) findViewById(R.id.lvMessages);

        //creating your adapter, it could be a custom adapter as well
        ArrayAdapter<String> adapter  = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1);

        //your test devices' ids
        String[] testDevicesIds = new String[]{getString(R.string.testDeviceID),AdRequest.DEVICE_ID_EMULATOR};
        //when you'll be ready for release please use another ctor with admobReleaseUnitId instead.
        adapterWrapper = new AdmobAdapterWrapper(this, testDevicesIds);
        //By default both types of ads are loaded by wrapper.
        // To set which of them to show in the list you should use an appropriate ctor
        //adapterWrapper = new AdmobAdapterWrapper(this, testDevicesIds, EnumSet.of(EAdType.ADVANCED_INSTALLAPP));

        //wrapping your adapter with a AdmobAdapterWrapper.
        adapterWrapper.setAdapter(adapter);
        //inject your custom layout and strategy of binding for installapp/content  ads
        //here you should pass the extended NativeAdLayoutContext
        //by default it has a value InstallAppAdLayoutContext.getDefault()
        //adapterWrapper.setInstallAdsLayoutContext(...);
        //by default it has a value ContentAdLayoutContext.getDefault()
        //adapterWrapper.setContentAdsLayoutContext(...);

        //Sets the max count of ad blocks per dataset, by default it equals to 3 (according to the Admob's policies and rules)
        adapterWrapper.setLimitOfAds(3);

        //Sets the number of your data items between ad blocks, by default it equals to 10.
        //You should set it according to the Admob's policies and rules which says not to
        //display more than one ad block at the visible part of the screen,
        // so you should choose this parameter carefully and according to your item's height and screen resolution of a target devices
        adapterWrapper.setNoOfDataBetweenAds(10);

        adapterWrapper.setFirstAdIndex(2);

        lvMessages.setAdapter(adapterWrapper); // setting an AdmobAdapterWrapper to a ListView
        lvMessages.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                final AdmobAdapterCalculator adapterCalc = adapterWrapper.getAdapterCalculator();
                int fetchedAdsCnt = adapterWrapper.getFetchedAdsCount();
                int sourceCnt = adapterWrapper.getAdapter().getCount();
                int originalPos = adapterCalc.getOriginalContentPosition(position, fetchedAdsCnt, sourceCnt);
                Toast.makeText(getApplicationContext(),
                        "Click: " + String.valueOf(originalPos),
                        Toast.LENGTH_SHORT).show();
            }
        });

        //preparing the collection of data
        final String sItem = "item #";
        ArrayList<String> lst = new ArrayList<String>(100);
        for(int i=1;i<=100;i++)
            lst.add(sItem.concat(Integer.toString(i)));

        //adding a collection of data to your adapter and rising the data set changed event
        adapter.addAll(lst);
        adapter.notifyDataSetChanged();
    }
private void initListViewItems ( ) { lvMessages = ( ListView ) findViewById ( R . id . lvMessages ) ; //creating your adapter, it could be a custom adapter as well ArrayAdapter < String > adapter = new ArrayAdapter < String > ( this , android . R . layout . simple_list_item_1 ) ; //your test devices' ids String [ ] testDevicesIds = new String [ ] { getString ( R . string . testDeviceID ) , AdRequest . DEVICE_ID_EMULATOR } ; //when you'll be ready for release please use another ctor with admobReleaseUnitId instead. adapterWrapper = new AdmobAdapterWrapper ( this , testDevicesIds ) ; //By default both types of ads are loaded by wrapper. // To set which of them to show in the list you should use an appropriate ctor //adapterWrapper = new AdmobAdapterWrapper(this, testDevicesIds, EnumSet.of(EAdType.ADVANCED_INSTALLAPP)); //wrapping your adapter with a AdmobAdapterWrapper. adapterWrapper . setAdapter ( adapter ) ; //inject your custom layout and strategy of binding for installapp/content  ads //here you should pass the extended NativeAdLayoutContext //by default it has a value InstallAppAdLayoutContext.getDefault() //adapterWrapper.setInstallAdsLayoutContext(...); //by default it has a value ContentAdLayoutContext.getDefault() //adapterWrapper.setContentAdsLayoutContext(...); //Sets the max count of ad blocks per dataset, by default it equals to 3 (according to the Admob's policies and rules) adapterWrapper . setLimitOfAds ( 3 ) ; //Sets the number of your data items between ad blocks, by default it equals to 10. //You should set it according to the Admob's policies and rules which says not to //display more than one ad block at the visible part of the screen, // so you should choose this parameter carefully and according to your item's height and screen resolution of a target devices adapterWrapper . setNoOfDataBetweenAds ( 10 ) ; adapterWrapper . setFirstAdIndex ( 2 ) ; lvMessages . setAdapter ( adapterWrapper ) ; // setting an AdmobAdapterWrapper to a ListView lvMessages . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { @ Override public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { final AdmobAdapterCalculator adapterCalc = adapterWrapper . getAdapterCalculator ( ) ; int fetchedAdsCnt = adapterWrapper . getFetchedAdsCount ( ) ; int sourceCnt = adapterWrapper . getAdapter ( ) . getCount ( ) ; int originalPos = adapterCalc . getOriginalContentPosition ( position , fetchedAdsCnt , sourceCnt ) ; Toast . makeText ( getApplicationContext ( ) , "Click: " + String . valueOf ( originalPos ) , Toast . LENGTH_SHORT ) . show ( ) ; } } ) ; //preparing the collection of data final String sItem = "item #" ; ArrayList < String > lst = new ArrayList < String > ( 100 ) ; for ( int i = 1 ; i <= 100 ; i ++ ) lst . ( sItem . concat ( Integer . toString ( i ) ) ) ; //adding a collection of data to your adapter and rising the data set changed event adapter . addAll ( lst ) ; adapter . notifyDataSetChanged ( ) ; }
Inits an adapter with items, wrapping your adapter with a {@link AdmobAdapterWrapper} and setting the listview to this wrapper
FIRST OF ALL Please notice that the following code will work on a real devices but emulator!
Inits an adapter with items wrapping your adapter with a {