List of usage examples for android.database MatrixCursor addRow
public void addRow(Iterable<?> columnValues)
From source file:com.roamprocess1.roaming4world.ui.favorites.FavLoader.java
/** * Creates a cursor that contains contacts group corresponding to an sip * account.//from w w w . ja v a 2 s . c o m */ private Cursor createContentCursorFor(SipProfile account) { Cursor c = null; if (!TextUtils.isEmpty(account.android_group)) { c = ContactsWrapper.getInstance().getContactsByGroup(getContext(), account.android_group); } if (c != null) { return c; } MatrixCursor mc = new MatrixCursor(new String[] { BaseColumns._ID, ContactsWrapper.FIELD_TYPE }); mc.addRow(new Object[] { account.id, ContactsWrapper.TYPE_CONFIGURE }); return mc; }
From source file:org.schabi.newpipe.search_fragment.SuggestionListAdapter.java
public void updateAdapter(List<String> suggestions) { MatrixCursor cursor = new MatrixCursor(columns); int i = 0;/*from w ww. j av a 2s .c o m*/ for (String s : suggestions) { String[] temp = new String[2]; temp[0] = Integer.toString(i); temp[1] = s; i++; cursor.addRow(temp); } changeCursor(cursor); }
From source file:org.schabi.newpipe.SuggestionListAdapter.java
public void updateAdapter(ArrayList<String> suggestions) { MatrixCursor cursor = new MatrixCursor(columns); int i = 0;/*from www . j a v a2s. co m*/ for (String s : suggestions) { String[] temp = new String[2]; temp[0] = Integer.toString(i); temp[1] = s; i++; cursor.addRow(temp); } changeCursor(cursor); }
From source file:org.sufficientlysecure.keychain.ui.widget.CacheTTLSpinner.java
private void initView(Context context) { CacheTTLPrefs prefs = Preferences.getPreferences(context).getPassphraseCacheTtl(); MatrixCursor cursor = new MatrixCursor(new String[] { "_id", "TTL", "description" }, 5); int i = 0;/*from w w w . ja v a2s .c o m*/ for (int ttl : CacheTTLPrefs.CACHE_TTLS) { if (!prefs.ttlTimes.contains(ttl)) { continue; } cursor.addRow( new Object[] { i++, ttl, getContext().getString(CacheTTLPrefs.CACHE_TTL_NAMES.get(ttl)) }); } setAdapter(new SimpleCursorAdapter(getContext(), R.layout.simple_item, cursor, new String[] { "description" }, new int[] { R.id.simple_item_text }, 0)); }
From source file:ro.expectations.expenses.ui.transactions.TransactionsActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { MatrixCursor matrixCursor = new MatrixCursor( new String[] { ExpensesContract.Accounts._ID, ExpensesContract.Accounts.TITLE }); matrixCursor.addRow(new Object[] { "0", getString(R.string.all_accounts) }); MergeCursor mergeCursor = new MergeCursor(new Cursor[] { matrixCursor, data }); ((AccountsSpinnerAdapter) mAccountsSpinner.getAdapter()).swapCursor(mergeCursor); setSpinnerItemById(mSelectedAccountId); }
From source file:com.abcvoipsip.ui.favorites.FavLoader.java
/** * Creates a cursor that contains a single row and maps the section to the * given value.//from w ww . j a v a2 s. co m */ private Cursor createHeaderCursorFor(SipProfile account) { MatrixCursor matrixCursor = new MatrixCursor(new String[] { BaseColumns._ID, ContactsWrapper.FIELD_TYPE, SipProfile.FIELD_DISPLAY_NAME, SipProfile.FIELD_WIZARD }); matrixCursor.addRow( new Object[] { account.id, ContactsWrapper.TYPE_GROUP, account.display_name, account.wizard }); return matrixCursor; }
From source file:org.schabi.newpipe.fragments.search.SuggestionListAdapter.java
/** * Update the suggestion list//ww w .ja v a2 s . com * @param suggestions the list of suggestions */ public void updateAdapter(List<String> suggestions) { MatrixCursor cursor = new MatrixCursor(columns, suggestions.size()); int i = 0; for (String suggestion : suggestions) { String[] columnValues = new String[columns.length]; columnValues[INDEX_TITLE] = suggestion; columnValues[INDEX_ID] = Integer.toString(i); cursor.addRow(columnValues); i++; } changeCursor(cursor); }
From source file:com.silentcircle.contacts.list.ProfileAndContactsLoader.java
/** * Loads the profile into a MatrixCursor. *//*from w w w . j av a 2s. c om*/ private MatrixCursor loadProfile() { Cursor cursor = getContext().getContentResolver().query(RawContacts.CONTENT_URI, mProjection, RawContacts.CONTACT_TYPE + "=" + RawContacts.CONTACT_TYPE_OWN, null, null); if (cursor == null) { return null; } try { MatrixCursor matrix = new MatrixCursor(mProjection); Object[] row = new Object[mProjection.length]; while (cursor.moveToNext()) { for (int i = 0; i < row.length; i++) { row[i] = cursor.getString(i); } matrix.addRow(row); } return matrix; } finally { cursor.close(); } }
From source file:com.csipsimple.ui.account.AccountsLoader.java
/** * Creates a cursor that contains a single row and maps the section to the * given value.//w ww .j a v a 2 s . c o m */ private Cursor createCursorForAccount(FilteredProfile fa) { MatrixCursor matrixCursor = new MatrixCursor(COLUMN_HEADERS); matrixCursor.addRow(new Object[] { fa.account.id, fa.account.id, fa.account.display_name, fa.account.wizard, fa.isForceCall ? 1 : 0, fa.rewriteNumber(numberToCall), fa.getStatusForOutgoing() ? 1 : 0, fa.getStatusColor() }); return matrixCursor; }
From source file:com.ffmpegtest.VideoActivity.java
@Override public void onFFDataSourceLoaded(FFmpegError err, FFmpegStreamInfo[] streams) { if (err != null) { String format = getResources().getString(R.string.main_could_not_open_stream); String message = String.format(format, err.getMessage()); Builder builder = new AlertDialog.Builder(VideoActivity.this); builder.setTitle(R.string.app_name).setMessage(message) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override//from ww w . java 2 s . c om public void onCancel(DialogInterface dialog) { VideoActivity.this.finish(); } }).show(); return; } mPlayPauseButton.setBackgroundResource(android.R.drawable.ic_media_play); mPlayPauseButton.setEnabled(true); this.mControlsView.setVisibility(View.VISIBLE); this.mStreamsView.setVisibility(View.VISIBLE); this.mLoadingView.setVisibility(View.GONE); this.mVideoView.setVisibility(View.VISIBLE); MatrixCursor audio = new MatrixCursor(PROJECTION); MatrixCursor subtitles = new MatrixCursor(PROJECTION); subtitles.addRow(new Object[] { "None", FFmpegPlayer.NO_STREAM }); for (FFmpegStreamInfo streamInfo : streams) { CodecType mediaType = streamInfo.getMediaType(); Locale locale = streamInfo.getLanguage(); String languageName = locale == null ? getString(R.string.unknown) : locale.getDisplayLanguage(); if (FFmpegStreamInfo.CodecType.AUDIO.equals(mediaType)) { audio.addRow(new Object[] { languageName, streamInfo.getStreamNumber() }); } else if (FFmpegStreamInfo.CodecType.SUBTITLE.equals(mediaType)) { subtitles.addRow(new Object[] { languageName, streamInfo.getStreamNumber() }); } } mLanguageAdapter.swapCursor(audio); mSubtitleAdapter.swapCursor(subtitles); }