1

私はコードを書いています。そのコードでは、クラスからのCheckboxesそれらを使用して動的に作成しています。ActionListenernon-Activity

ここで、からいくつかのユーザーインターフェイスを変更したいと思いますCompoundButton.OnCheckedChangeListener()

それぞれcheckboxがアラームを表します。Database各アラームには、アラームを有効にするか無効にするかを指定して設定されてcolumnいます。そのためには、データベースにアクセスする必要があります。私は次のコードを書いています:

public class DataBaseAdapter extends SQLiteOpenHelper 
{
    ....
    .... //onCreate, onUpdate, other methods used.
    ....
public TableLayout getAllAlarmList(Context con)
{
    SQLiteDatabase db = this.getReadableDatabase();
    for(int i=0;i<maxCount;i++) //maxCount number of rows in database
    {
        check[i]= new CheckBox(con);
        check[i].setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
        {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
            {
                if(isChecked)
                {

                }
                else
                {

                }
            }
        });
    }

}

ここに、データベースアクセスコードを追加できるコードを追加する必要があります。どうやってするの。?

4

1 に答える 1