title: how to create an array and fetch the data in sqlite database in android
body: <p>in my app i have two edit boxes for email and username. Whatever the user types in it i am trying to move it over an url as follows
  <strong>http//xxxxxxx.com/id?mail=*<em>email</strong>&amp;user=</em>*usernane</p>
  
  <p>By this i am getting a return data from the url, this is what i am doing if network is available. But if network is not available i am storing those two values in Sqlite database and in another activity if network is available i will be fetching the above said data and i will move them to the server.</p>
  
  <p>My problem is, at the time of network not available if the user tries to send two set of username and email to the server it gets stored in database. How can i store those values in an array and how can i fetch them one by one. Please help me friends</p>
  
  <p>Following is the part of my code for database</p>
  
  <pre><code>off = openOrCreateDatabase("Offline.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
  off.setVersion(1);
  off.setLocale(Locale.getDefault());
  off.setLockingEnabled(true);
  final String CREATE_TABLE_OFFLINEDATA ="CREATE TABLE IF NOT EXISTS offlinedata(spotid INTEGER, username TEXT, email TEXT);";
  off.execSQL(CREATE_TABLE_OFFLINEDATA);
  ContentValues values = new ContentValues();
  values.put("id", millis);
  values.put("name", username);
  values.put("mail", email);
  off.insert("offlinedata", null, values);
  Cursor con = off.rawQuery("select * from offlinedata"  , null);
  if (con != null ) 
  {
     if  (con.moveToFirst()) 
     {
      do 
        {
      int spotid = con.getInt(con.getColumnIndex("id"));
      String first = con.getString(con.getColumnIndex("username"));
      String middle = con.getString(con.getColumnIndex("email"));
         }
        while (con.moveToNext());
        }
      }
     off.close();    
  </code></pre>
  
  <p>Please help me friends....</p>