Note that there are some explanatory texts on larger screens.

plurals
  1. POArrayAdapter with admob adview ListView Crash
    primarykey
    data
    text
    <p>IM trying to put an admob AdView into a ListView by way of an ArrayAdapter. Currently it loads fine and the ad appears as expected into the listview. When I scroll, and when the row containing the ad is out of view, the app freezes. I suppose that the removal of the adview is causing some problems. Is there a way to prevent this? Or is there a way to detect when a row is being removed from the listview? Or even better is there a way that the row does not get cleared from the listview and is retained?</p> <p>here is what i have in the adapter getView Method :</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; ChapterModel chapter = getItem(position); LinearLayout L; if (row == null) { LayoutInflater inflater = (LayoutInflater) this.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.chapter_listview_ad, parent, false); } AdRequest request = new AdRequest(); AdView adView; L=(LinearLayout) row.findViewById(R.id.chapter_row_layout); adView= new AdView((Activity) this.context,new AdSize(768,90), ADDID); adView.setAdListener(this); adView.loadAd(request); L.addView(adView); return row; } </code></pre> <p>eclipse gives me: NullPopinterException in the image below <img src="https://i.stack.imgur.com/KdNX2.png" alt="enter image description here"></p> <p>note: this works but causes the add to be removed an reloaded every time it goes off the screen:</p> <pre><code>public int getItemViewType(int position) { // Don't let ListView try to reuse the views. return AdapterView.ITEM_VIEW_TYPE_IGNORE; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload