I a developing an app whereby i retrieve data from an sqlite database and the data is displayed on a listview I am retrieving data from two columns of a specific table and it is added to a SimpleCursorAdapter which is then set to the listview i would like to display each record in the different columns to be displayed on its own row currently data from both columns is displayed in one row any help will be appreciated especially a link to a working example
i have deicded to add my code maybe this will help you help me even better
mDicCursor=managedQuery(DictionaryProvider.CONTENT_URI, null, null,
new String[] {query}, null);
if (mDicCursor == null ) {
mTextView.setText(getString(R.string.no_results, new Object[] {query}));
/* final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("WORD MISSING");*/
showDialog(DIALOG_WORDMISSING);
//new AlertDialog.Builder(this).setTitle("Argh").setMessage("Watch out!").setNeutralButton("Close", null).show();
} else {
int count = mDicCursor.getCount();
String countString = getResources().getQuantityString(R.plurals.search_results,
count, new Object[] {count, query});
mTextView.setText(countString);
/* int iWord = mDicCursor.getColumnIndexOrThrow(DictDatabase.REC_DESCRIPTION);
mTextView.setText(mDicCursor.getString(iWord));*/
// Specify the columns we want to display in the result
String[] from = new String[]{ DictDatabase.REC_WORD,
DictDatabase.REC_DESCRIPTION };
// and an array of the fields we want to bind those fields to (in this case just text1)
int[] to = new int[]{ R.id.text2,
R.id.text3};
SimpleCursorAdapter words =
new SimpleCursorAdapter(this, R.layout.dictwords, mDicCursor, from, to);
mListView.setAdapter(words);