English 中文(简体)
未持续检查的扩展列表复选框
原标题:expandablelistview checkboxes not staying checked

我正在使用一个本地的 sqlite db 来保存一切。 当我在扩展列表中打开一个组时, 检查了所有存储在该复选框中的复选框。 当我编辑一个条目( 我使用了 AwardDialog ), 关闭了该组, 然后重新打开该组。 复选框不再检查 。 我检查了 db 并保存了编辑 。 如果我去到另一个页面后再回来, 一旦点击该组, 我编辑的子项将再次检查 。 我使用日食中的断点, 它似乎在 db 中找到数据, 但没有将该框标记为选中 。 有任何想法吗?

""https://i.sstatic.net/eVBdG.png" alt="此处输入图像描述"/ >

这是当我第一次点击组( 引擎) 时的图像

""https://i.sstatic.net/c6D8a.png" alt="此处输入图像描述"/ >

现在我正在使用警报Dialog 来更新条目

""https://i.sstatic.net/UrCxi.png" alt="此处输入图像描述"/ >

现在,我把大家关了

""https://i.sstatic.net/x2LZf.png" alt="此处输入图像描述"/ >

当我重新打开电池的盒子时 电池不再被检查

这里是我打开一个团体时的代码

public void onGroupExpand(int groupPosition)
{
    db= new InspectionRecordsTableDBAdapter(getBaseContext());
    db.open();
    int inspectionId = com.signalsetapp.inspectionchecklist.report
            .returnStringID();
    String [] child=kids[groupPosition];
    ArrayList<Color> secList = new ArrayList<Color>();
    for(int i=0; i<child.length;i++)
    {
        try {
            if (db.childFound(inspectionId, child[i]))
                secList.add(new Color(child[i], true));
            else
                secList.add(new Color(child[i], false));
        时 时 catch (Exception e) {
            secList.add(new Color(child[i], false));
            e.printStackTrace();
        时 时

    时 时

时 时

这是在 db 中保存的更新代码。 这确实适当地保存到 db 中

db.editRecords(
                                        primaryId,
                                        com.signalsetapp.inspectionchecklist.report
                                                .returnStringID(),
                                        parent[groupPosition],
                                        kids[groupPosition][childPosition],
                                        input.getText().toString(), status);
                                onExpand=true;
最佳回答

您应该保存到数据库后 requery () your group 光标组, 它应该重新生成列表视图( 或者由于 requery 已被折旧) 。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签