Advertisement
Ankhwatcher

highestRoute

Apr 17th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1.     public int highestRoute() {
  2.         SQLiteDatabase db = getReadableDatabase();
  3.         int highRoute = 0;
  4.         try {
  5.  
  6.             Cursor results = db.rawQuery("SELECT MAX(" + ROUTE_NUMBER + ") FROM " + TABLE_NAME, null);
  7.             if (results.moveToFirst()) {
  8.                 highRoute = results.getInt(0);
  9.             }
  10.             results.close();
  11.         } catch (Exception e) {
  12.             Log.e(FixOpenHelper.class.getName(), "Unable to get highestRoute.", e);
  13.         }
  14.        
  15.         return highRoute;
  16.  
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement