title: Sort DB data and display in list view
body: <p>I get data from my DB using </p>
  
  <pre><code>cursor = db.query("WebLeadMaster", select, "condition1="+conditionVal1+
  " and condition2="+ConditionVal2,null, null, null, "RegistrationTime DESC");
  </code></pre>
  
  <p>I am getting the data in my cursor alright. To display the data, i use the following code:</p>
  
  <pre><code>    SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, 
              R.layout.resultleadlookup, cursor, columns, to); 
      mAdapter.notifyDataSetChanged();
      lstResult.setAdapter(mAdapter);
  </code></pre>
  
  <p>So, I cannot modify the contents of the cursor. The sort query has condition "RegistrationTime" which is a <strong><em>String data type.</em></strong> As you can see in the image below, it is not in a proper sorted format. (not according to date-time).</p>
  
  <p>What changes should i make in my code so that it would sort properly according to date-time?</p>
  
  <p><img src="https://i.stack.imgur.com/QOYuX.png" alt="expected output and actual output"></p>
  
  <p>If i alter my DB query, to look like </p>
  
  <pre><code>cursor = db.query("WebLeadMaster", select, "condition1="+conditionVal1+
  " and condition2="+ConditionVal2,null, null, null, null);
  </code></pre>
  
  <p>it gives an ascending order. All i want it the descending order.</p>