Cursor getColumnNames - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Cursor getColumnNames method.

This code example shows how to use the following methods:getColumnIndex, getColumnNames, getString
        int count = getMockContentResolver().delete(uri, null, null);
        assertEquals("Failed to delete " + uri, 1, count);
    } 
 
    private static String getCol(Cursor c, String name) {
        int col = c.getColumnIndex(name);
        String msg = "Column " + name + " not found, columns: "
                + Arrays.toString(c.getColumnNames());
        assertTrue(msg, col >= 0);
        return c.getString(col);
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getColumnNames, getString, moveToFirst
            Cursor cursor = resolver.query(uri, new String[] {
                    columnName
            }, null, null, null); 
            if (cursor == null)
                return null; 
            Log.i(TAG, uri.toString() + " columns: " + cursor.getColumnNames());
            cursor.moveToFirst();
            int nameIndex = cursor.getColumnIndex(columnName);
            if (nameIndex > -1) {
                Log.i(TAG,
                        "Column " + columnName + " (" + nameIndex + ") is '"
                                + cursor.getString(nameIndex) + "'");
                return cursor.getString(nameIndex);
            } 
        } catch (Exception e) {
            e.printStackTrace();
        } 
        return null; 
    } 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnNames
    return wrappedCursor.getColumnName(i);
  } 
 
  @Implementation 
  public String[] getColumnNames() {
    return wrappedCursor.getColumnNames();
  } 
 
  @Implementation 
  public int getColumnCount() { 
    return wrappedCursor.getColumnCount();
  } 
 
  @Implementation 
  public byte[] getBlob(int i) {
    return wrappedCursor.getBlob(i);
  } 
 
  @Implementation 
  public String getString(int i) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:close, getColumnNames
 
		try { 
			c = db.rawQuery("SELECT * FROM " + tableName + " LIMIT 1", null);
 
			if (c != null) {
				ar = new ArrayList<String>(Arrays.asList(c.getColumnNames()));
			} 
 
		} catch (Exception e) {
			Log.v(tableName, e.getMessage(), e);
			e.printStackTrace();
		} finally { 
			if (c != null)
				c.close();
		} 
		return ar;
	} 
 
	public static String join(List<String> list, String delim) {
		StringBuilder buf = new StringBuilder();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnNames
        return wrappedCursor.getColumnName(i);
    } 
 
    @Implementation 
    public String[] getColumnNames() {
        return wrappedCursor.getColumnNames();
    } 
 
    @Implementation 
    public int getColumnCount() { 
        return wrappedCursor.getColumnCount();
    } 
 
    @Implementation 
    public byte[] getBlob(int i) {
        return wrappedCursor.getBlob(i);
    } 
 
    @Implementation 
    public String getString(int i) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getColumnNames, getString
        int count = getMockContentResolver().delete(uri, null, null);
        assertEquals("Failed to delete " + uri, 1, count);
    } 
 
    private static String getCol(Cursor c, String name) {
        int col = c.getColumnIndex(name);
        String msg = "Column " + name + " not found, columns: "
                + Arrays.toString(c.getColumnNames());
        assertTrue(msg, col >= 0);
        return c.getString(col);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnNames, getInt, moveToPosition
            return new View(context);
        } 
 
        @Override 
        protected void bindView(View v, int partition, Cursor cursor, int position) {
            if (!cursor.moveToPosition(position)) {
                fail("Invalid position:" + partition + " " + cursor.getColumnNames()[0] + " "
                        + position);
            } 
 
            mRequests.append(partition + cursor.getColumnNames()[0] + "["
                    + cursor.getInt(0) + "] ");
        } 
 
        @Override 
        public String toString() {
            return mRequests.toString().trim();
        } 
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColumnNames
        return mActiveCursor.getColumnName(columnIndex);
    } 
 
    @Override 
    public String[] getColumnNames() {
        return mActiveCursor.getColumnNames();
    } 
 
    @Override 
    public int getCount() { 
        // CursorLoaders seem to call getCount() a lot. So we're caching the aggregated count. 
        if (mCount == -1) {
            int count = 0;
            for (Cursor cursor : mCursors) {
                if (cursor != null) {
                    count += cursor.getCount();
                } 
            } 
 
            mCount = count;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:close, getColumnNames
		List<String> ar = null;
		Cursor c = null;
		try { 
			c = db.rawQuery("select * from " + tableName + " limit 1", null);
			if (c != null) {
				ar = new ArrayList<String>(Arrays.asList(c.getColumnNames()));
			} 
		} catch (final Exception e) {
			e.printStackTrace();
		} finally { 
			if (c != null) {
				c.close();
			} 
		} 
		return ar;
	} 
 
	public static String join(final List<String> list, final String delim) {
		final StringBuilder buf = new StringBuilder();
		final int num = list.size();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:close, getColumnNames
        List<String> ar = null;
        Cursor c = null;
        try { 
            c = db.rawQuery("select * from " + tableName + " limit 1", null);
            if (c != null) {
                ar = new ArrayList<String>(Arrays.asList(c.getColumnNames()));
            } 
        } catch (Exception e) {
            Log.v(tableName, e.getMessage(), e);
            e.printStackTrace();
        } finally { 
            if (c != null)
                c.close();
        } 
        return ar;
    } 
 
    public static String join(List<String> list, String delim) {
        StringBuilder buf = new StringBuilder();
        int num = list.size();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Cursor getColumnNames Questions & Answers:

getColumnNames Method Overview
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.
See Code Examples for other Android Cursor Methods: