Question

This is what I have done right now.

My table is like this:

JAPANESEALPHA            ENGLISH          JAPANESECHAR
kiro                     kilo            \u30ad\u30ed
guramu                   gram            \u30b0\u30e9\u30e0
migi                     right           \u307f\u304e
mijikai                  short           \u307f\u3058\u304b\u3044

Inside database (example):

mDbHelper.createCrv("kiro","kilo","\u30ad\u30ed");
mDbHelper.createCrv("guramu","gram","\u30b0\u30e9\u30e0");
mDbHelper.createCrv("mijikai","short","\u307f\u3058\u304b\u3044");
mDbHelper.createCrv("minami","south","\u307f\u306a\u307f");
mDbHelper.createCrv("miru","watch","\u307f\u308b");

Query:

 String query = "SELECT docid as _id," + 
    KEY_ENGLISH + "," +
    KEY_JAPANESEALPHA + "," +
    KEY_JAPANESECHAR+ 
    " from " + FTS_VIRTUAL_TABLE +
    " where " +  KEY_JAPANESEALPHA + " = '" + inputText + "';";

I also have Cursor:

 private void showResults(String query) {

        Cursor cursor = mDbHelper.searchCrvJapanesechar((query != null ? query.toString() : "@@@@"));
        if (cursor == null) {
            Toast.makeText(getApplicationContext(), 
                    "No Search Found!", Toast.LENGTH_LONG).show();

        } else {

            // Specify the columns we want to display in the result 
            String[] from = new String[] {
                    DBAdapter.KEY_JAPANESECHAR,
                   DBAdapter.KEY_JAPANESEALPHA,
                   DBAdapter.KEY_ENGLISH
                   };
                    //DBAdapter.KEY_TAGALOG};


            // Specify the Corresponding layout elements where we want the columns to go
            int[] to = new int[] {     R.id.sjapanesechar,
                   R.id.sjapanesealpha,
                    R.id.senglish};
                   // R.id.stagalog};

For compound words, I need to minimize my database so that when the

Input: kiroguramu

I can concatenate the english term of kiru and english term of guramu. That will result

Result: kilogram

Sorry I can't paste my sample images because I'm newbie. I have get the retrieving data at http://www.mysamplecode.com/2011/11/android-searchview-using-sqlite-fts3.html It was a great help. Thankyou.

Was it helpful?

Solution

Hi I think you should try to read some basic of JSON parsing here http://www.androidhive.info/2012/01/android-json-parsing-tutorial/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top