How to add list from cursor to intent in share button

I have an app where I use content provider to work with DB. I have a list, which is inflated and shown to the user. I need to save that list into intent and send it with share button like what I found here

Here are my questions-

1) Do I need to convert cursor to list or do I need to create a second list and inflate it with cursor or is there any other variant?
2) How can I customize the look of recieved message?

Here is my code-

public class CatalogActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {

    private static final String TAG = "myLogs";

    /** Identifier for the pet data loader */
    private static final int LIST_LOADER = 0;

    /** Adapter for the ListView */
    ListCursorAdapter mCursorAdapter;

    protected void onCreate(Bundle savedInstanceState) {

        Log.v(TAG, "Зашли в catalog activity oncreate");

        // Setup FAB to open EditorActivity
        FloatingActionButton fab = (FloatingActionButton) findViewById(;
        fab.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent intent = new Intent(CatalogActivity.this, EditorActivity.class);

        // Find the ListView which will be populated with the list data
        ListView listListView = (ListView) findViewById(;

        // Find and set empty view on the ListView, so that it only shows when the list has 0 items.
        View emptyView = findViewById(;

        // Setup an Adapter to create a list item for each row of list data in the Cursor.
        // There is no items data yet (until the loader finishes) so pass in null for the Cursor.
        mCursorAdapter = new ListCursorAdapter(this, null);

        // Setup the item click listener
        listListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                ShoppingListBdHelper helper = new ShoppingListBdHelper(view.getContext());
                if (helper.setCompleted(id)) {

        // Kick off the loader
        getSupportLoaderManager().initLoader(LIST_LOADER, null, this);

     * Helper method to insert hardcoded item data into the database. For debugging purposes only.
    private void insertPet() {

        Log.v(TAG, "Создали insertpet");

        Intent myIntent = new Intent(Intent.ACTION_SEND);

        String shareBody = "Body here";
        String shareSub = "Sub here";
        myIntent.putExtra(Intent.EXTRA_TEXT, shareSub);
        myIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(myIntent, "Share using"));

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu options from the res/menu/menu_catalog.xml file.
        // This adds menu items to the app bar.
        getMenuInflater().inflate(, menu);
        return true;

    public boolean onOptionsItemSelected(MenuItem item) {
        // User clicked on a menu option in the app bar overflow menu
        switch (item.getItemId()) {
            // Respond to a click on the "Insert dummy data" menu option
                return true;
            // Respond to a click on the "Delete all entries" menu option
                return true;
                return true;
        return super.onOptionsItemSelected(item);
     * Helper method to delete all list in the database.
    private void deleteAllItems() {

        Log.v(TAG, "Сработал метод удаления всех данных");
        long rowsDeleted = getContentResolver().delete(ListContract.ListEntry.CONTENT_URI, null, null);
        Log.v("CatalogActivity", rowsDeleted + " rows deleted from list database");

    private void shareIntent(){
        ArrayList<String> list = new ArrayList<String>();

        Intent sendIntent = new Intent();
        sendIntent.putStringArrayListExtra("test", (ArrayList<String>) list);

    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
        Log.v(TAG, "Начал работать loader cursor");
        // Define a projection that specifies the columns from the table we care about.
        String[] projection = {

        // This loader will execute the ContentProvider's query method on a background thread
        return new CursorLoader(this,   // Parent activity context
                ListContract.ListEntry.CONTENT_URI,   // Provider content URI to query
                projection,             // Columns to include in the resulting Cursor
                null,                   // No selection clause
                null,                   // No selection arguments
                null);                  // Default sort order


    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        // Update {@link ListCursorAdapter} with this new cursor containing updated pet data
        Log.v(TAG, "Cursor adapter загрузился");

    public void onLoaderReset(Loader<Cursor> loader) {
        // Callback called when the data needs to be deleted

You can use ArrayList Instead StringBuilder you just need to convert your ArrayList into StringBuilder and pass builder.toString() so I think it will be working for you.