Android搜索查询和按顺序排序

时间:2015-10-06 14:21:13

标签: android sqlite search

任何人都知道如何做到这一点?我在下面有一个常规搜索查询,在列表视图中显示匹配的数据,我尝试将COLUMN NAME +" ASC"在订单部分,但我有错误。

<?php
    $result = getcaseList("Anaphylaxis");
?>
    <div role="tabpanel" class="tab-pane" id="emergency">
        <div class="container-fluid">
           <div class="panel-group" id="accordion">
<?php

    error_reporting(E_ALL ^ E_NOTICE);

    foreach($result as $case_data)
    {
?>

        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $case_data['case_id'];?>">
<?php echo $case_data['case_name'];?><br />
                    </a>
                </h4>
            </div>
            <div id="collapse<?php echo $case_data['case_id'];?>" class="panel-collapse collapse ">
                <div class="panel-body">
                <h4></h4> <?php echo $case_data['case_description'];?>
            </div>
            <div class="panel-body">
                <h4></h4><?php echo $case_data['case_causes'];?>
            </div>

1 个答案:

答案 0 :(得分:1)

'order by'子句应该是查询调用中的第8个参数:

Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, KEY_NAME + " LIKE ?",
                    new String[] {"%"+ query+ "%" }, null, null, COLUMN_NAME + " ASC", null);

请参阅:Documentation