Question

Please help I really do not know and tired. I have:

SimpleAdapter adapter = new SimpleAdapter(this, IrrList,
            R.layout.list_item, new String[] { Form1, Form2, Form3 },
                                   new int[] { R.id.text1, R.id.text2, R.id.text3 });   
                listView.setTextFilterEnabled(true);
                adapter.getFilter().filter("changing value");
                listView.setAdapter(adapter);

and:

@Override
public Dialog onCreateDialog(int id) {
  switch (id) {
  case IDD_CHECK_LIST:
    final boolean[] mCheckedItems = { false, false, false };
    final String[] checkList = { "list 1", "list 2", "list 3" };
      ad = new AlertDialog.Builder(this);
      ad.setTitle("Get list")
    .setCancelable(false)
    .setMultiChoiceItems(checkList , mCheckedItems,
    new DialogInterface.OnMultiChoiceClickListener() {
      @Override
      public void onClick(DialogInterface dialog,
        int which, boolean isChecked) {
        mCheckedItems[which] = isChecked;
    }
    })
    .setPositiveButton("yes",
    new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int id) {
        StringBuilder state = new StringBuilder();
        for (int i = 0; i < checkList .length; i++) {
          state.append("" + checkList [i]);
        if (mCheckedItems[i])
        state.append(" +\n");
        else
            state.append(" -\n");
    }
        Toast.makeText(getApplicationContext(),
        state.toString(), Toast.LENGTH_LONG).show();


    }
})

I want to change the values in the filter of adapter "changing value" using check_box in a dialog. How can I do it?. I want:

  1. when "list1" is "true" use one value in the:

adapter.getFilter().filter("here");

  1. when "list2" or "list3" is "true" use anather value.

  2. and when "list1" with "list2" or "list3" is "true" use someone.

i tried to put sting:

String ChangedValue = "value";
adapter.getFilter().filter(ChangedValue);

but dont know how to change it in the check_box.

Was it helpful?

Solution

wtf! I searched answer 2 day but it is so easy. (((((

setFiltr("3.");

and

public void setFiltr(String aaa)
    {
        ListView listView = (ListView) findViewById(R.id.listView1);
        R.layout.list_item, new String[] { Form1, Form2, Form3 },
                                       new int[] { R.id.text1, R.id.text2, R.id.text3 });   
            listView.setTextFilterEnabled(true);
        adapter1.getFilter().filter(aaa);
        listView.setAdapter(adapter1);

    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top