I am building a search app and present the results in TextView inside a ListView. I want to bold the queried phrase/word in the search result. My SQLite select command is:
SELECT docid as _id,
COLUMN_1,
COLUMN_2,
COLUMN_3,
COLUMN_4,
snippet(FTS_VIRTUAL_TABLE)
from FTS_VIRTUAL_TABLE
where COLUMN_1 MATCH inputText;
Following is the String Array to be displayed in Separate TextView in ListView
String[] arr = new String[]
{
Html.fromHtml(COLUMN_1).toString(),
COLUMN_2,
COLUMN_3
};
and my text views
int[] tViews = new int[] { R.id.tv1,
R.id.tv2,
R.id.tv3}
And finally my cursor adapter
SimpleCursorAdapter myCursorAd = new SimpleCursorAdapter(this,R.layout.layout1, cursor, arr, tViews);
mListView.setAdapter(myCursorAd);
I dont know what's wrong here. Its not working. It just displays the text as it is without any bold formatting.
0 comments:
Post a Comment