Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to not get the integer array again
    primarykey
    data
    text
    <p>Im making question and answer. my question generate randomly but, the question repeated again.</p> <p>im using txt file as my database when the int array generate randomly my holder get what is string line in my database. supposed to be int array = x, and string line = y; {y==x}. my question is when i generate again the question get again, what supposed i will do guys?.</p> <pre><code> private void question() { InputStreamReader inputStream = new InputStreamReader (getResources().openRawResource(R.raw.question1)); BufferedReader br = new BufferedReader(inputStream); ArrayList&lt;Integer&gt; ar= new ArrayList&lt;Integer&gt;(); int[] number= {1,2,3,4,5,6,7,8,9,10}; for (int i : number) { ar.add(i); } Random r = new Random(); int select = r.nextInt(ar.size()); int random = ar.get(select); ar.remove(select); String theLine=""; int lineCtr = 0; try { while ((theLine = br.readLine()) != null) { if (lineCtr == select) { StringTokenizer st = new StringTokenizer(theLine,","); while(st.hasMoreTokens()) { //reading and getting data from the database"," String a = st.nextToken(); String b = st.nextToken(); String c = st.nextToken(); String d = st.nextToken(); String e = st.nextToken(); String f = st.nextToken(); //button setText question.setText(a); ca.setText(f); firstbutton.setText(e); secondbutton.setText(d); thirdbutton.setText(b); fourthbutton.setText(c); //assigning firstholder =e; secondholder =d; thirdholder=b; fourthholder =c; break; } }lineCtr++; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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