Strange bug with sqlite android
Question
I'm facing BIG and strange problem , i have sqlite android database app on many mobile phones what is works perfectly , but when uses my app on lenovo or asus 7 inch tablet I'm facing no records stored in database , so i think maybe there some problems with getting current data with local.getdefualt()
here is my code :
INSERT statment :
public long addCheckPoint(String fleetNumber, String NoOFStudents,String Location_Longitude,String Location_Latitude){
SQLiteDatabase db = this.getWritableDatabase();
String ActionDate = new SimpleDateFormat("yyyy-MM-ddhh:mm:ss",Locale.getDefault()).format(new Date());
ContentValues values = new ContentValues();
values.put("FleetNumber", fleetNumber);
values.put("CheckPointID", CheckPoint(fleetNumber));
values.put("NoOFStudents", NoOFStudents);
values.put("Location_Longitude", Location_Longitude);
values.put("Location_Latitude", Location_Latitude);
values.put("ActionDate", ActionDate);
values.put("PathStatus", "Open");
return db.insert("CheckPoints",null, values);
}
getting result statment :
public Cursor getCheckPointRows(String fleetNumber){
SQLiteDatabase db = this.getWritableDatabase();
String ActionDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String qq = "select CheckPointID , FleetNumber, NoOFStudents , ActionDate from CheckPoints where FleetNumber = "+ fleetNumber +" and date(ActionDate)='"+ActionDate+"'" ;
Cursor cursor = db.rawQuery(qq, null);
if(cursor != null && cursor.moveToFirst()){
return cursor;
}
db.close();
return cursor;
}
table strc
// SQL statement to create CheckPoints table
String CREATE_CheckPoints_TABLE = "CREATE TABLE CheckPoints ( " +
"ID INTEGER PRIMARY KEY AUTOINCREMENT , " +
"FleetNumber INTEGER, "+
"CheckPointID INTEGER,"+
"NoOFStudents INTEGER,"+
"Location_Longitude TEXT,"+
"Location_Latitude TEXT,"+
"PathStatus TEXT,"+
"ActionDate TEXT)" ;
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow