title: Android - Display SQLite database query in a specific timeframe
body: <p>I am developing an app to keep track the time of phone usage.
  The problem is, i need to display the time usage just in a day. 
  for example i need to display from database the time my apps used only from 12.00 am - 11.59 pm
  and the time need to be reset in the next day.</p>
  
  <p>here is my code:</p>
  
  <pre><code> public void onCreate(SQLiteDatabase db) {
      String CREATE_APPTIME_TABLE = "CREATE TABLE app_time (" +
              "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
              "packageName TEXT UNIQUE," +
              "appName TEXT," +
              "elapsedTime INTEGER )";
  </code></pre>
  
  <p>and here is the query to retrieve the time</p>
  
  <pre><code>public List&lt;AppTime&gt; getAllAppTime() {
      List&lt;AppTime&gt; appTimes = new LinkedList&lt;AppTime&gt;();
  
      // build query
      String query = "SELECT * FROM " + TABLE_APPTIME + " WHERE " + KEY_TIME + " &gt; 0";
  
      // get reference to writable DB
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(query, null);
  </code></pre>
  
  <p>i need to display the elapsedTime from 12.00 a.m until 11.59 pm daily and reset the time in the next day.</p>
  
  <p>Thank you. :)</p>