Returning all rows of a column from my content provider
<p>I'm trying to access a Content Provider I already made (which I made by very closely following a tutorial, I've tested it with the code the tutorial walked me through and it works fine) and read the email addresses that I've added into a SQLite database. In the database is the ID, a COLUMN_NAME, and a COLUMN_EMAIL. I want to get all the rows for the email column and have that be an ArrayList of strings that's returned into this activity.</p>
<p>So far my best guess is that somewhere somehow I'll query the database using the query method from the content provider, return the cursor to the activity, and then collect all the Strings from the rows and either manage to send a query with a projection for just that column or filter out all the @lorem.com's or second index of the cursor or some kind of post data retrieval filter.</p>
<p>Basically I'm just pretty stuck.</p>
<p>Okay so here's my code:</p>
<pre><code>public class EmailScheduler extends AppCompatActivity implements LoaderManager
        .LoaderCallbacks&lt;Cursor&gt; {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_email_scheduler);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        final TextView emailText = (TextView) findViewById(R.id.emailText);
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Cursor cursor = getContacts();
                Log.i(&quot;TAG&quot;, cursor.getColumnName(2));
                emailText.append(cursor.toString());
            }
        });
    }

    private static final int CONTACT_LOADER = 0;
    public Uri contactUri;
    ArrayList&lt;String&gt; addresses = new ArrayList&lt;&gt;();
    Cursor cursor;

    private Cursor getContacts() {
        // Run query
        Uri uri = Contact.CONTENT_URI;
        String[] projection = new String[] { Contact._ID,
                Contact.COLUMN_NAME };
        String selection = Contact.COLUMN_EMAIL + &quot; = '&quot;
                + (&quot;1&quot;) + &quot;'&quot;;
        String[] selectionArgs = null;
        String sortOrder = Contact.COLUMN_NAME
                + &quot; COLLATE LOCALIZED ASC&quot;;
        return getContentResolver().query(uri, projection, selection, selectionArgs,
                sortOrder);
    }
    // called by LoaderManager to create a Loader
    @Override
    public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) {
        CursorLoader cursorLoader;

        switch (id) {
            case CONTACT_LOADER:
                cursorLoader = new CursorLoader(this,
                        contactUri, // Uri of contact to display
                        null, // null projection returns all columns
                        null, // null selection returns all rows
                        null, // no selection arguments
                        null); // sort order
                break;
            default:
                cursorLoader = null;
                break;
        }

        return cursorLoader;
    }

    @Override
    public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {

        Log.i(&quot;TAG&quot;, &quot;got to the beginning of onloadfinish &quot; + data);
        if (data != null &amp;&amp; data.moveToFirst()) {
            int nameIndex = data.getColumnIndex(Contact.COLUMN_NAME);
            int emailIndex = data.getColumnIndex(Contact.COLUMN_EMAIL);
            String address = data.getString(emailIndex);
            Log.i(&quot;TAG&quot;, address);

            while (data.getString(emailIndex) != null){
                addresses.add(cursor.getString(cursor.getColumnIndex(
                        Contact.COLUMN_EMAIL)));
                Log.i(&quot;TAG&quot;, addresses.toString());}
        }
    }

    @Override
    public void onLoaderReset(Loader&lt;Cursor&gt; loader) { }
}
</code></pre>
<p>In the onCreate method it returns this data when I run it:  android.content.ContentResolver$CursorWrapperInner@60c9bd2</p>
<p>How do I get the information I need from that? Everything I try turns into a dead end.</p>