java - android SQLite method malfunction(?!?!) -
i face weird problem sqlite; have dynamically generated db, checkbox list... when first open app doesn't load in linear layout, sqlite query doesn't return string! when change fragment (from first pane map pane) , go (to first pane should see checkbox list)everything works supposed work , checkbox list appears! logcat doesn't show exception or suspicious...
this method:
private int setcheckboxes(){ sqlitedatabase database = databasemanager.getinstance().opendatabase(); database.setlocale(locale.getdefault()); string queryroutes="select * from"+tableroute; cursor dataroutes = database.rawquery(queryroutes, null); arraylist<string> routesstrings = new returnmapstuff().getroutesarray(dataroutes); databasemanager.getinstance().closedatabase(); routesstrings.size(); try{ checkbox cb; (int = 0; < routesstrings.size(); i++) { cb = new checkbox(context); cb.settext(routesstrings.get(i)); cb.setid(i); ll.addview(cb); } }catch (exception e){e.printstacktrace();} return routesstrings.size(); }
and how call it:
view view = inflater.inflate(r.layout.fragment_main, container, false); ll = (linearlayout) view.findviewbyid(r.id.checkboxll); int howmanycheckboxes =setcheckboxes(); logcat few log.i(): 04-01 09:22:40.883 2412-2412/pack.androidmap i/posa checkboxes?﹕ 0 //return value(setcheckboxes()) first runs (inside)returnmapstuff(): 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ paralia 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ petalo 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ partali 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ ateik 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ pagni 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ λύκαστος 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ smallville 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ αλί καρνέησον 04-01 09:23:00.451 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ καμπαμαρούν // when press (first returnmapstuff()): 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ paralia 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ petalo 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ partali 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ ateik 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ pagni 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ λύκαστος 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ smallville 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ αλί καρνέησον 04-01 09:23:04.843 2412-2412/pack.androidmap i/posa route mesa mapstuff?﹕ καμπαμαρούν //then return value of setcheckboxes() 04-01 09:23:04.847 2412-2412/pack.androidmap i/posa checkboxes?﹕ 9
how possible?
actually sqlite query doesn't return string!
you miss space here
string queryroutes="select * from"+tableroute;
it must be
string queryroutes="select * "+tableroute;
Comments
Post a Comment