Show the Ad in ListView Footer

In ListView, If you want to show your Ad(Advertisement) on Footer view.

Just Add this lines in your code:

View footerView = ((LayoutInflater) getActivity().getSystemService(
Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.ads_banner_layout, null, false);
WebView webView = (WebView) footerView.findViewById(R.id.ads_view);
listview.addFooterView(footerView);

listview.setAdapter(adapter);

footerView is the view to inflate the ad_banner layout into your listview.

Myself I'm using the webview to show the add, but its your choice to add some kind of different layouts and widgets in your footerview.



Comments

Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java

Print the large string values in android log cat.