In a Cursor, column index is 0 based.
That is if you want to fetch data from 1st column then you should use cursor.getString(0)
instead of cursor.getString(1)
So you need to replace
if(cursor.getCount() > 0){
System.out.println("enter into if of hashmap");
user.put("username", cursor.getString(1));
user.put("name", cursor.getString(2));
user.put("email", cursor.getString(3));
user.put("user_id", cursor.getString(4));
user.put("country", cursor.getString(5));
user.put("state", cursor.getString(6));
user.put("city", cursor.getString(7));
user.put("registered_on", cursor.getString(8));
}
by following code....
if(cursor.getCount() > 0){
System.out.println("enter into if of hashmap");
user.put("username", cursor.getString(0));
user.put("name", cursor.getString(1));
user.put("email", cursor.getString(2));
user.put("user_id", cursor.getString(3));
user.put("country", cursor.getString(4));
user.put("state", cursor.getString(5));
user.put("city", cursor.getString(6));
user.put("registered_on", cursor.getString(7));
}
In your code its trying to fetch data from 9th column which does not exists.