Code example for MatrixCursor

Methods: addRow

0
		 
		setListAdapter(new ItemSectionAdapter(this, mCursor));
    } 
     
    private void requestCursor() { 
		mCursor = new MatrixCursor(new String[] { "_id", "Section", "Name" });
		 
		mCursor.addRow(new String []{ "3","Section 1", "Item 1" });
		mCursor.addRow(new String []{ "2", "Section 1", "Item 2" });
		mCursor.addRow(new String []{ "4","Section 2", "Item 3" });
		mCursor.addRow(new String []{ "5","Section 2", "Item 4" });
		mCursor.addRow(new String []{ "6","Section 2", "Item 5" });
		mCursor.addRow(new String []{ "7","Section 2", "Item 6" });
		mCursor.addRow(new String []{ "8","Section 2", "Item 7" });
		mCursor.addRow(new String []{ "9","Section 3", "Item 8" });
		mCursor.addRow(new String []{ "9","Section 3", "Item 9" });
		mCursor.addRow(new String []{ "9","Section 3", "Item 10" });
		mCursor.addRow(new String []{ "9","Section 3", "Item 11" });
		mCursor.addRow(new String []{ "9","Section 4", "Item 12" });
		mCursor.addRow(new String []{ "9","Section 4", "Item 13" });
		mCursor.addRow(new String []{ "9","Section 5", "Item 14" });
		mCursor.addRow(new String []{ "9","Section 5", "Item 15" });
		mCursor.addRow(new String []{ "9","Section 5", "Item 16" });
	} 
     
    @Override 
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Cursor c = (Cursor) getListAdapter().getItem(position);
Stop searching for code, let great code find you!  Add Codota to your java IDE