小编Ste*_*s M的帖子

我可以在列表单击时关闭警报对话框吗?

我有一个警告对话框,上面有一个列表,我想关闭onlistclick它可能吗?

    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    final String[] Categories = SQLiteHelper.getAllCategories();//this is where i get the array for my list
    ListView myList = new ListView(this);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.alert_dialog_list_view, Categories);
    myList.setAdapter(adapter);
    myList.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
                     //doing something in here and then close
         }
    });
    builder.setTitle("Please Choose");
    builder.setInverseBackgroundForced(true);
    builder.setView(myList);
    final Dialog dialog = builder.create();
    dialog.show();
    }
Run Code Online (Sandbox Code Playgroud)

警报对话框运行完美,我只是不想在其中放置任何按钮.

android android-alertdialog

7
推荐指数
1
解决办法
4624
查看次数

Android SQL查询带有两个"Where"子句

您好我有一个SQL查询,我希望它有两个WHERE子句.我希望它在我的数据库中查询Bid和Cid并将其返回到游标,我的代码

     public Cursor getSubCategoriesQuerybyCidandBid(String Cid, int Bid) {
        this.openDataBase();
        Cursor c;
         String[] asColumnsToReturn = new String[] {SECOND_COLUMN_ID, SECOND_COLUMN_IDENTITY, SECOND_COLUMN_SUBCATEGORIES};
         c =dbSqlite.query(false, TABLE_NAME, asColumnsToReturn, COLUMN_BID + "=" + Bid + COLUMN_CID + "=" + Cid , null, null, null, null, null);
         return c;
    }
Run Code Online (Sandbox Code Playgroud)

这就是我想要它的方式,但这不是任何想法如何解决这个问题?

sqlite android

3
推荐指数
1
解决办法
6628
查看次数

标签 统计

android ×2

android-alertdialog ×1

sqlite ×1