List of usage examples for android.database MatrixCursor MatrixCursor
public MatrixCursor(String[] columnNames)
From source file:org.schabi.newpipe.SuggestionListAdapter.java
public void updateAdapter(ArrayList<String> suggestions) { MatrixCursor cursor = new MatrixCursor(columns); int i = 0;/* ww w . j a v a 2s .c om*/ 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.search_fragment.SuggestionListAdapter.java
public void updateAdapter(List<String> suggestions) { MatrixCursor cursor = new MatrixCursor(columns); int i = 0;/*from w w w . ja v a 2 s .com*/ 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:com.actionbarsherlock.sample.demos.SearchViews.java
@Override public boolean onCreateOptionsMenu(Menu menu) { //Used to put dark icons on light action bar boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; //Create the search view SearchView searchView = new SearchView(getSupportActionBar().getThemedContext()); searchView.setQueryHint("Search for countries"); searchView.setOnQueryTextListener(this); searchView.setOnSuggestionListener(this); if (mSuggestionsAdapter == null) { MatrixCursor cursor = new MatrixCursor(COLUMNS); cursor.addRow(new String[] { "1", "'Murica" }); cursor.addRow(new String[] { "2", "Canada" }); cursor.addRow(new String[] { "3", "Denmark" }); mSuggestionsAdapter = new SuggestionsAdapter(getSupportActionBar().getThemedContext(), cursor); }//from w w w. j av a 2 s. co m searchView.setSuggestionsAdapter(mSuggestionsAdapter); menu.add("Search").setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search) .setActionView(searchView) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true; }
From source file:com.rightscale.provider.rest.ServerMonitorsResource.java
private Cursor buildCursor(String serverId, JSONArray array) throws JSONException { MatrixCursor result = new MatrixCursor(COLUMNS); int nServerId = Integer.parseInt(serverId); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); MatrixCursor.RowBuilder row = result.newRow(); buildRow(nServerId, row, object); }//w w w .ja v a2s . c o m return result; }
From source file:piuk.blockchain.android.ExchangeRatesProvider.java
@Override public Cursor query(final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder) { if (exchangeRates == null) { exchangeRates = getExchangeRates(); if (exchangeRates == null) return null; }//from w w w .j ava2s . c o m final MatrixCursor cursor = new MatrixCursor( new String[] { BaseColumns._ID, KEY_CURRENCY_CODE, KEY_EXCHANGE_RATE }); if (selection == null) { for (final Map.Entry<String, Double> entry : exchangeRates.entrySet()) cursor.newRow().add(entry.getKey().hashCode()).add(entry.getKey()).add(entry.getValue()); } else if (selection.equals(KEY_CURRENCY_CODE)) { if (selectionArgs == null) return null; final String code = selectionArgs[0]; final Double rate = exchangeRates.get(code); cursor.newRow().add(code.hashCode()).add(code).add(rate); } return cursor; }
From source file:com.sbox.absforpwdassi.demo.SearchViews.java
@Override public boolean onCreateOptionsMenu(Menu menu) { //Used to put dark icons on light action bar boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; //Create the search view SearchView searchView = new SearchView(getSupportActionBar().getThemedContext()); searchView.setQueryHint("Search for countries"); searchView.setOnQueryTextListener(this); searchView.setOnSuggestionListener(this); if (mSuggestionsAdapter == null) { MatrixCursor cursor = new MatrixCursor(COLUMNS); cursor.addRow(new String[] { "1", "'Murica" }); cursor.addRow(new String[] { "2", "Canada" }); cursor.addRow(new String[] { "3", "Denmark" }); mSuggestionsAdapter = new SuggestionsAdapter(getSupportActionBar().getThemedContext(), cursor); }/* w ww . j a v a2s . co m*/ searchView.setSuggestionsAdapter(mSuggestionsAdapter); menu.add("Search").setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search) .setActionView(searchView) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true; }
From source file:com.rightscale.provider.rest.ServerSettingsResource.java
private Cursor buildCursor(String serverId, JSONObject object) throws JSONException { int nServerId = Integer.parseInt(serverId); MatrixCursor result = new MatrixCursor(COLUMNS); MatrixCursor.RowBuilder row = result.newRow(); buildRow(nServerId, row, object);/*from w ww. j a v a 2 s . c om*/ return result; }
From source file:io.valuesfeng.picker.loader.AlbumLoader.java
@Override public Cursor loadInBackground() { Cursor albums = super.loadInBackground(); MatrixCursor allAlbum = new MatrixCursor(PROJECTION); long count = 0; if (albums.getCount() > 0) { while (albums.moveToNext()) { count += albums.getLong(3);// w w w.j a v a2s. c o m } } allAlbum.addRow(new String[] { Album.ALBUM_ID_ALL, Album.ALBUM_NAME_ALL, MEDIA_ID_DUMMY, count + "" }); return new MergeCursor(new Cursor[] { allAlbum, albums }); }
From source file:com.rightscale.provider.rest.DeploymentsResource.java
public Cursor show(String id) throws RestException { try {/*from w w w . ja v a2 s . c om*/ MatrixCursor result = new MatrixCursor(COLUMNS); JSONObject deployment = getJsonObject("deployments/" + id + ".js"); String href = deployment.getString("href"); String nickname = deployment.getString("nickname"); MatrixCursor.RowBuilder row = result.newRow(); row.add(id); row.add(href); row.add(nickname); return result; } catch (JSONException e) { throw new ProtocolError(e); } }
From source file:com.laevatein.internal.loader.AlbumPhotoLoader.java
@Override public Cursor loadInBackground() { Cursor result = super.loadInBackground(); if (!mEnableCapture || !MediaStoreCompat.hasCameraFeature(getContext())) { return result; }/* ww w. j a va2 s . c om*/ MatrixCursor dummy = new MatrixCursor(PROJECTION); dummy.addRow(new Object[] { Item.ITEM_ID_CAPTURE, Item.ITEM_DISPLAY_NAME_CAPTURE }); return new MergeCursor(new Cursor[] { dummy, result }); }