Android : Put SQLite data in BaseAdapter -


Currently creating custom list view with base (base image, ressource and database) with basebed. I have a problem putting data from SQL data inside basadapter. My code looks like this, database code:

  public hashmap < String, string & gt; GetResult (String Year) {Hashmap & lt; String, string & gt; Questionmap = new Hashmap & lt; String, string & gt; (); SQLiteDatabase database = this.getReadableDatabase (); String selectQuery = "SELECT _id, COLUMN_B, COLUMN_C to TABLE_NAME where YEAR_COLUMN = '+ + + year +"'; cursor cursor = database. Stroke (selected, zero); If (cursor.moveToFirst ()) {to {questionmap .put ("_ id", cursor.getString (0)); Questionmap.put ("COLUMN_B", cursor .getString (1)); Questionmap.put ("COLUMN_C", cursor .getString (2));} while (Cursor.movetynext ());} question question return;}   

and here my base adapter looks: singlerow_info {string A, B, C; Int img; Singlerow_info (String A, String B, String C, IIT IIG) {this.A = A; Ii = b; c = c; this.img = img;}} class result adder extends the baseAdapter {// Get the YEAR value from the previous activity Intent intent = getIntent (); string year = intent .getStringExtra (" YEAR "); Hashmap Questionmap = myDb.getResult (year); ArrayList & quot; singlerow_info> list; results adapter (reference C) {List = New Arrestist & lt; singlerow_info & gt; (); // Get String A from String Resources and get the string [] B and [] from the C database resource ress = c.getResources (); String [] a = ress.getStringArray (R.array.exam_question); // here is obtained B, C to DB, here im stuck with string [] B =; String [] c =; Int [] images = {R.drawable.icon_1, R.drawable.icon_2}; For (int i = 0; i <40; i ++) {list.add (new singlove_info (a [ii], b [ii], c [ii], images [i]); }}

Please help

The class result provides an adapter basseterrer {// Get the YEAR value from last activity Intent intent = getIntent (); String year = intent .getStringExtra ("YEAR"); ArrayList QuestionsMapub, questionmapC; ArrayList List; As a result (reference C) {List = New Arrestist & lt; Singlerow_info & gt; (); QuestionmapB = new arreelist & lt; String & gt; QuestionmapC = new arreelist & lt; String & gt; ReadFromDB (); // Get String A from String Resources and get the string [] B and [] from the C database resource ress = c.getResources (); String [] a = ress.getStringArray (R.array.exam_question); // here is B, C to DB, here im stuck with int [] images = {R.drawable.icon_1, R.drawable.icon_2}; For (Int i = 0; I & lt; 40; i ++) {list.add (new singolo_info (a [i], questionmap b.get (i), question mark C. zest (i), images ])); }} Private Wide ReDardDB () {SQLite Database Database = this.getReadableDatabase (); String selectQuery = "SELECT _id, COLUMN_B, COLUMN_C to TABLE_NAME where YEAR_COLUMN = '+ + + year +"'; cursor cursor = database. Stroke (selected, zero); if (cursor.mivostost ()) {to {questionmapB .put ("COLUMN_B", cursor .getString (1)); QuestionmapC.put ("COLUMN_C", cursor .getString (2));} while (cursor.moveteonext ());}}

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -