List of usage examples for android.database MatrixCursor MatrixCursor
public MatrixCursor(String[] columnNames)
From source file:Main.java
/** * Creates new cursor, closes it and returns it ^^ * //from ww w . j a v a 2 s . c o m * @return the newly closed cursor. */ public static MatrixCursor newClosedCursor() { MatrixCursor cursor = new MatrixCursor(new String[0]); cursor.close(); return cursor; }
From source file:com.grayfox.android.app.widget.CategoryCursorAdapter.java
public CategoryCursorAdapter(Context context) { super(context, new MatrixCursor(new String[] { CursorColums._ID, CursorColums.CATEGORY_ICON_URL, CursorColums.CATEGORY_NAME, CursorColums.CATEGORY_FOURSQUARE_ID }), 0); }
From source file:com.granita.tasks.groupings.cursorloaders.EmptyCursorLoaderFactory.java
public EmptyCursorLoaderFactory(Context context, String[] projection) { super(context, new AbstractCustomCursorFactory(projection) { @Override// w w w . j av a 2 s. c o m public Cursor getCursor() { return new MatrixCursor(mProjection); } }); }
From source file:com.dvdprime.mobile.android.adapter.DocumentSuggestionsAdapter.java
public static MatrixCursor getCursor(String query) { // ? ?? //w w w. j ava2 s . com final String[] COLUMNS = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2 }; MatrixCursor cursor = new MatrixCursor(COLUMNS); cursor.addRow(new Object[] { 1, query, " " }); cursor.addRow(new Object[] { 2, query, "ID " }); cursor.addRow(new Object[] { 6, query, " " }); cursor.addRow(new Object[] { 4, query, "? " }); cursor.addRow(new Object[] { 7, query, " " }); return cursor; }
From source file:com.rightscale.provider.rest.DeploymentsResource.java
public Cursor index() throws RestException { MatrixCursor result = new MatrixCursor(COLUMNS); JSONArray response = getJsonArray("deployments.js"); for (Integer i : sortJsonArray(response, "nickname")) { try {// w ww . j a v a 2 s . c o m JSONObject deployment = response.getJSONObject(i); String href = deployment.getString("href"); int id = Integer.valueOf(href.substring(href.lastIndexOf('/') + 1)).intValue(); //TODO error handling String nickname = deployment.getString("nickname"); MatrixCursor.RowBuilder row = result.newRow(); row.add(id); row.add(href); row.add(nickname); } catch (JSONException e) { throw new ProtocolError(e); } } return result; }
From source file:android.support.test.testapp.CursorAdapterListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listItemCursor = new MatrixCursor(COLUMN_NAMES); populateData();/*w w w . jav a 2s. co m*/ final ListAdapter cursorAdapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_list_item_2, listItemCursor, new String[] { COLUMN_STR, COLUMN_LEN }, new int[] { android.R.id.text1, android.R.id.text2 }, 0); setListAdapter(cursorAdapter); }
From source file:cm.aptoide.pt.LatestLikesComments.java
public Cursor getComments() { endPointComments = String.format(endPointComments, repoName); MatrixCursor cursor = new MatrixCursor(new String[] { "_id", "apkid", "name", "text", "username", "time" }); try {/* w ww. j av a 2 s . c om*/ NetworkUtils utils = new NetworkUtils(); JSONObject respJSON = utils.getJsonObject(endPointComments, context); JSONArray array = respJSON.getJSONArray("listing"); for (int i = 0; i != array.length(); i++) { String apkid = ((JSONObject) array.get(i)).getString("apkid"); String name = ((JSONObject) array.get(i)).getString("name"); String text = ((JSONObject) array.get(i)).getString("text"); String timestamp = ((JSONObject) array.get(i)).getString("timestamp"); Date date = Configs.TIME_STAMP_FORMAT.parse(timestamp); String time = DateTimeUtils.getInstance(context).getTimeDiffString(date.getTime()); String username = ((JSONObject) array.get(i)).getString("username"); if (username.equals("NOT_SIGNED_UP")) { username = ""; } cursor.newRow().add(i).add(apkid).add(name).add(text).add(username).add(time); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return cursor; }
From source file:com.laevatein.internal.loader.AlbumLoader.java
@Override public Cursor loadInBackground() { Cursor albums = super.loadInBackground(); MatrixCursor allAlbum = new MatrixCursor(PROJECTION); allAlbum.addRow(new String[] { Album.ALBUM_ID_ALL, Album.ALBUM_NAME_ALL, MEDIA_ID_DUMMY }); return new MergeCursor(new Cursor[] { allAlbum, albums }); }
From source file:com.dmsl.anyplace.nav.AnyPlaceSeachingHelper.java
public static Cursor prepareSearchViewCursor(List<? extends IPoisClass> places) { String req_columns[] = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_INTENT_DATA }; MatrixCursor mcursor = new MatrixCursor(req_columns); int i = 0;//from w w w . j a va2s .c om if (places != null) { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(IPoisClass.class, new IPoisClass.MyInterfaceAdapter()); Gson gson = gsonBuilder.create(); for (IPoisClass p : places) { mcursor.addRow(new String[] { Integer.toString(i++), p.name(), p.description().equals("") ? "no description" : p.description(), gson.toJson(p, IPoisClass.class) }); } } return mcursor; }
From source file:com.dvdprime.mobile.android.adapter.DocumentSuggestionsAdapter.java
public static MatrixCursor getCursor2(String query) { // ? ?? //w ww. ja v a2 s . c om final String[] COLUMNS = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2 }; MatrixCursor cursor = new MatrixCursor(COLUMNS); cursor.addRow(new Object[] { 1, query, " " }); cursor.addRow(new Object[] { 2, query, "ID " }); cursor.addRow(new Object[] { 4, query, "? " }); cursor.addRow(new Object[] { 7, query, " " }); return cursor; }