title: how to use an ArrayAdapter in android of custom objects
body: <p>How can I use the properties of a custom object in a Listview. If I implement an ArrayAdapter with a list of Strings it displays fine in Listview but when I use a list of custom objects, it just outputs the memory address. </p>
  
  <p>The code I have up to now:</p>
  
  <pre><code>ArrayList&lt;CustomObject&gt; allObjects = new ArrayList&lt;&gt;();
  
  allObjects.add("title", "http://url.com"));
  
  
    ArrayAdapter&lt;NewsObject&gt; adapter = new ArrayAdapter&lt;NewsObject&gt;(this,
                  android.R.layout.simple_list_item_1, android.R.id.text1, allNews);
  
  
          // Assign adapter to ListView
          listView.setAdapter(adapter);
  
  
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                  Uri uri = Uri.parse( "http://www.google.com" );
                  startActivity(new Intent(Intent.ACTION_VIEW, uri));
              }
          });
  </code></pre>
  
  <p>There is a similar question <a href="https://stackoverflow.com/questions/11593574/adding-a-custom-object-to-an-arrayadapter-how-to-grab-data">here</a> but that is not what I need since I just need to have the title show in list view and when they click extract the url.</p>