jeudi 4 février 2016

android get X kilometers radius values from database

i'm working sqlite.i successfully create db and table and inserted some values.

enter image description here

i wrote some code witch can to show some values by ETEN(table row)

 public List<Product> getListProduct() {
    Product product = null;
    List<Product> productList = new ArrayList<Product>();
    openDatabase();
    Cursor cursor = mDatabase.rawQuery("SELECT * FROM product WHERE ETEN ='" + eten_tostring + "'", null);
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        product = new Product(cursor.getInt(0),
                cursor.getString(1),
                cursor.getString(2),
                cursor.getString(3),
                cursor.getInt(4),
                cursor.getString(5));
        productList.add(product);
        cursor.moveToNext();
    }
    cursor.close();
    closeDatabase();
    return productList;
}

now i want to redirect my method.i want to return some values by ETEN and also for example values witch is a 4km radius( i have some latitude and longitude in my database) how i can solve my problem if anyone knows solution please help me i want select method

Aucun commentaire:

Enregistrer un commentaire