title: How to add native ads in a listview?
body: <p>this is my activity
  i want to insert a native ads into the list view.
  I'm trying to follow this guide <a href="https://github.com/StartApp-SDK/Documentation/wiki/android-advanced-usage" rel="noreferrer">https://github.com/StartApp-SDK/Documentation/wiki/android-advanced-usage</a> But I find it hard to understand.
  can you give me a hand, maybe making examples of code? thank you</p>
  
  <p>ACTIVITY</p>
  
  <pre><code>public class EpisodiActivity extends Activity {
  
  private StartAppAd startAppAd = new StartAppAd(this);
  
  public class ViewModel {
      private String url;
      private String name;
  
      public ViewModel(String url, String name) {
          this.url = url;
          this.name = name;
      }
  
      public String getUrl() {
          return this.url;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      public String getName() {
          return this.name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String toString() {
          return this.name;
      }
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // creazione fullscreen activity
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);
      setContentView(R.layout.episodi_activity);
  
      String[] episodi = getIntent().getStringArrayExtra("Product");
      String[] urls = getIntent().getStringArrayExtra("urls");
  
      ListView mylist = (ListView) findViewById(R.id.listView1);
  
      // And in this loop we create the ViewModel instances from
      // the name and url and add them all to a List
      List&lt;ViewModel&gt; models = new ArrayList&lt;ViewModel&gt;();
      for (int i = 0; i &lt; episodi.length; i++) {
          String name = episodi[i];
          String url = "No value";
          if (i &lt; urls.length) {
              url = urls[i];
          }
          ViewModel model = new ViewModel(url, name);
          models.add(model);
      }
  
      // Here we create the ArrayAdapter and assign it to the ListView
      // We pass the List of ViewModel instances into the ArrayAdapter
      final ArrayAdapter&lt;ViewModel&gt; adapter = new ArrayAdapter&lt;ViewModel&gt;(
              this, android.R.layout.simple_list_item_1, models);
  
      mylist.setAdapter(adapter);
  
      mylist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position,
                  long id) {
  
              // Here we get the ViewModel at the given position
              ViewModel model = (ViewModel) arg0.getItemAtPosition(position);
  
              // And the url from the ViewModel
              String url = model.getUrl();
  
              startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
          }
      });
  }
  
  @Override
  public void onResume() {
      super.onResume();
      startAppAd.onResume();
      startAppAd.showAd();
  }
  
  @Override
  public void onPause() {
      super.onPause();
      startAppAd.onPause();
  }
  </code></pre>
  
  <p>}</p>