Note that there are some explanatory texts on larger screens.

plurals
  1. POapp not showing data when opend it for the second time
    primarykey
    data
    text
    <p>i am looking to make game of questions and answers.i had taken a textview and 4 radio group buttons.and i am fetching data from the external data file from the assets folder.when i installs the app into the emulater it works fine.when i reopens the app in the emulater it is just showing question not showing any text in the radio buttons.here is my code in the data base file</p> <pre><code>public String makeatext(String My_database_table,int i) { SQLiteDatabase myDB = getDatabase(); String results = new String(); try { String firstColumn = "questions"; // final String KEY_ROWID = "id"; // Cursor c = myDB.rawQuery("SELECT questions FROM " + // My_database_table+ ";",null); Cursor c = myDB.query(true, My_database_table, new String[] { firstColumn },null, null, null, null, null, null); int iquestion = c.getColumnIndex(firstColumn); if(c.moveToPosition(i)){ results = c.getString(iquestion)+"\n"; } //while (c.moveToPosition(1)) { //String firstName = c.getString(iquestion); //results =(" "+ firstName + " "); //} return results; } catch (Exception e) { Log.e("ERROR","ERROR in Make test file :"+e.toString()); e.printStackTrace(); // TODO: handle exception } return results; } </code></pre> <p>and in the Activity file i am just calling it as</p> <pre><code>String shoow = myDb.makeatext("question", Qno); </code></pre> <p>showQuestion.setText(shoow); and on the top of the oncreate methode i initilized the data base as<code>private final DataBaseHelper myDb = new DataBaseHelper(this); </code>can any one say me why this is happenig.do i need to write the for loop in the activity file also or shall i take a cursor in the activity class .</p> <p>plz help me out</p> <p>thanks in advance</p> <p>for radio buttons the code in the database file is as follows as i have 4 buttons the code for 4 buttons will be as same as this</p> <pre><code>public String makeExtra1(String My_database_table ,int positions) { String results = new String(); try { String secondColumn = "Extra1"; Cursor c = myDataBase.query(true, My_database_table, new String[] { secondColumn }, null, null, null, null, null, null); int iExtra1 = c.getColumnIndex(secondColumn); if(c.moveToPosition(positions)){ results = results+c.getString(iExtra1)+"\n"; } return results; } catch (Exception e) { Log.e("ERROR","ERROR in Make test file :"+e.toString()); e.printStackTrace(); // TODO: handle exception } return results;} </code></pre> <p>and in the Activity file </p> <pre><code> String showextra1 = myDb.makeExtra1("question", Qno); r0.setText(showextra1); </code></pre> <p>i repeted this thing for 4 times as changing the makeExtra2,3,4 and in the assinged to r1,r2,r3 as above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload