Example usage for android.database Cursor getExtras

List of usage examples for android.database Cursor getExtras

Introduction

In this page you can find the example usage for android.database Cursor getExtras.

Prototype

Bundle getExtras();

Source Link

Document

Returns a bundle of extra values.

Usage

From source file:com.google.android.demos.rss.widget.ChannelAdapter.java

public static void setItemData(ItemDialog itemDialog, Cursor cursor) {
    Bundle extras = cursor.getExtras();
    String title = cursor.getString(COLUMN_TITLE);
    String url = cursor.getString(COLUMN_LINK);
    String description = cursor.getString(COLUMN_DESCRIPTION);
    String channel = extras.getString(Channels.TITLE_PLAINTEXT);
    itemDialog.setData(title, url, description, channel);
}

From source file:com.google.android.demos.atom.widget.FeedAdapter.java

public static void setEntryData(EntryDialog entryDialog, Cursor cursor) {
    Bundle extras = cursor.getExtras();
    String title = cursor.getString(COLUMN_TITLE);
    String url = cursor.getString(COLUMN_ALTERNATE_HREF);
    String summary = cursor.getString(COLUMN_SUMMARY);
    String content = cursor.getString(COLUMN_CONTENT);
    String feed = extras.getString(Feeds.TITLE_PLAINTEXT);
    entryDialog.setData(title, url, summary, content, feed);
}

From source file:com.google.android.demos.jamendo.widget.StatusViewManager.java

private static boolean hasError(Cursor data) {
    return data == null || data.getExtras().containsKey(FeedExtras.EXTRA_ERROR);
}

From source file:com.google.android.demos.atom.widget.FeedAdapter.java

public boolean hasError() {
    Cursor cursor = getCursor();
    return cursor != null && cursor.getExtras().containsKey(FeedExtras.EXTRA_ERROR);
}

From source file:com.google.android.demos.jamendo.widget.Loadable.java

/** {@inheritDoc} */
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    Bundle extras = data != null ? data.getExtras() : Bundle.EMPTY;
    mHasError = extras.containsKey(FeedExtras.EXTRA_ERROR);
    mHasMore = extras.getBoolean(FeedExtras.EXTRA_MORE);
    mCount = data != null ? data.getCount() : 0;
    mCallbacks.onLoadFinished(loader, data);
}

From source file:org.kontalk.ui.adapter.ContactsListAdapter.java

private void updateIndexer(Cursor cursor) {
    if (cursor == null) {
        setSectionIndexer(null);//  w  w w .j  a  v a  2  s.co m
        return;
    }

    Bundle bundle = cursor.getExtras();
    if (bundle.containsKey(MyUsers.Users.EXTRA_INDEX_TITLES)
            && bundle.containsKey(MyUsers.Users.EXTRA_INDEX_COUNTS)) {
        String sections[] = bundle.getStringArray(MyUsers.Users.EXTRA_INDEX_TITLES);
        int counts[] = bundle.getIntArray(MyUsers.Users.EXTRA_INDEX_COUNTS);

        setSectionIndexer(new ContactsSectionIndexer(sections, counts));
    } else {
        setSectionIndexer(null);
    }
}

From source file:com.google.android.feeds.ContentDecorator.java

private Bundle getCursorExtras() {
    if (mAdapter instanceof android.widget.CursorAdapter) {
        Cursor cursor = ((android.widget.CursorAdapter) mAdapter).getCursor();
        return cursor != null ? cursor.getExtras() : Bundle.EMPTY;
    } else if (isInstanceOfSupportCursorAdapter(mAdapter)) {
        Cursor cursor = supportGetCursor(mAdapter);
        return cursor != null ? cursor.getExtras() : Bundle.EMPTY;
    } else {//from   ww w .  ja  v  a 2  s. c  o  m
        return Bundle.EMPTY;
    }
}

From source file:com.btmura.android.reddit.app.MessageThingListController.java

@Override
public void swapCursor(Cursor cursor) {
    moreId = null;/*from ww  w.  java2  s .c  o  m*/
    adapter.swapCursor(cursor);
    cursorExtras = cursor != null ? cursor.getExtras() : null;
}

From source file:com.silentcircle.contacts.list.ProfileAndContactsLoader.java

@Override
public Cursor loadInBackground() {
    // First load the profile, if enabled.
    List<Cursor> cursors = new ArrayList<Cursor>();
    if (mLoadProfile) {
        cursors.add(loadProfile());/*from   w  ww . ja  v  a  2s.  c om*/
    }
    final Cursor contactsCursor = super.loadInBackground();
    cursors.add(contactsCursor);
    return new MergeCursor(cursors.toArray(new Cursor[cursors.size()])) {
        @Override
        public Bundle getExtras() {
            // Need to get the extras from the contacts cursor.
            return contactsCursor.getExtras();
        }
    };
}

From source file:android.support.content.TestQueryCallback.java

public void assertReceivedContent(Uri expectedUri, final int expectedPageId) {
    mReplyLatch.assertHasItem(new Matcher<Pair<Integer, Cursor>>() {
        @Override//from w  ww .j  ava 2  s  .c  o  m
        public boolean matches(Pair<Integer, Cursor> value) {
            return expectedPageId == value.first;
        }
    });
    List<Pair<Integer, Cursor>> collected = mReplyLatch.getCollected();
    Cursor cursor = null;

    for (Pair<Integer, Cursor> pair : collected) {
        if (expectedPageId == pair.first) {
            cursor = pair.second;
        }
    }

    assertEquals(0, cursor.getCount()); // we don't add any records to our test cursor.
    Bundle extras = cursor.getExtras();
    assertNotNull(extras);
    assertTrue(extras.containsKey(URI_KEY));
    assertEquals(extras.getParcelable(URI_KEY), expectedUri);
    assertTrue(extras.containsKey(URI_PAGE_ID));
    assertEquals(extras.getInt(URI_PAGE_ID), expectedPageId);
}