You have already done the hard part ... the material of the array is pretty simple:
String[] array = new String[crs.getCount()]; int i = 0; while(crs.moveToNext()){ String uname = crs.getString(crs.getColumnIndex("NAME")); array[i] = uname; i++; }
Be that as it may, I always recommend using collections in such cases:
List<String> array = new ArrayList<String>(); while(crs.moveToNext()){ String uname = crs.getString(crs.getColumnIndex("NAME")); array.add(uname); }
To compare arrays you can do things like this:
boolean same = true; for(int i = 0; i < array.length; i++){ if(!array[i].equals(ha[i])){ same = false; break; } }
source share