//Once try this. It will definitely work.
public String getDistance(String station_name){
String distance = null;
Cursor cursor = database.rawQuery("SELECT distance from station_data where name =? ", new String[] {station_name} );
if (cursor.moveToFirst())
{
distance = cursor.getString(0);
}
cursor.close();
return distance;
}
// Смотрите, что не так в вашем коде.
// cursor.moveToFirst () для перемещения курсора к первому индексу курсора.
// cursor.moveToNext () для перемещения курсора к следующему индексу.
// Посмотрите, что вы сделали здесь.
public String getDistance(String station_name){
String distance = null;
Cursor cursor = database.rawQuery("SELECT distance from station_data where name =? ", new String[] {station_name} );
cursor.moveToFirst(); // CURSOR INDEX = 0
while(cursor.moveToNext()){ // CURSOR INDEX = 1
distance = cursor.getString(0);
cursor.moveToNext();
}
cursor.close();
return distance;
}