Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Questions Tags Users Badges Unanswered Ask Question Shuffle the id of table to get details in android

0

162 views

I have student table , which has four fiels id, name, address and age. In this table 50 student. My question is , How to shuffle the id and get that id's details( id, name, address and age) and get the one id at a time and if i click the next button then next student details.

DatabaseHeper.java


 // I donot understand which code write in DatabaseHeper.java file 
 /*
public Cursor shuffleJokes(int [] id) {

        Cursor c = null;
    c = myDataBase.rawQuery("select _id,title,body from jokes where title ="
            + id, null);
    return c;
}*/

public void shuffleJokes(int [] ar) {       

Random rnd = new Random();
for (int i = ar.length - 1; i >= 0; i--)
{
  int index = rnd.nextInt(i + 1);
  // Simple swap
  int a = ar[index];
  ar[index] = ar[i];
  ar[i] = a;
}



shuffleStudnt.java


DatabaseHelper db;
Cursor cur
cur=db.shuffleArray(arrayofid);  // how to get arrayofid array which is id of student table
cur.moveToFirst();    


I have problem, in how to get table id in array. Please give me best solution which code write inDatabaseHeper.java and shuffleStudent.java file.

asked October 20, 2011 1:32 pm IST
/users/61481/

0 Answers

Be the first to answer this question

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions