0

The content of the dialog is a ListView, here's the adapter :

public class MultiSelectionSpinnerAdapter extends BaseAdapter {

    private Context ctx;
    private ArrayList<MultiSelectionItem> items;
    private LayoutInflater layoutInflater;

    public MultiSelectionSpinnerAdapter(Context ctx, ArrayList<MultiSelectionItem> items) {
        this.ctx = ctx;
        this.items = items;
        this.layoutInflater = LayoutInflater.from(ctx);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final MultiSelectionItem item = items.get(position);

        CheckBox checkBox;
        if (item.isEditable()) {
            convertView = layoutInflater.inflate(R.layout.editable_checkbox, parent, false);
            checkBox = (CheckBox) convertView.findViewById(R.id.editableCheckbox);

            EditText editText = (EditText) convertView.findViewById(R.id.editableEditText);
            editText.setText(item.getEditableValue());
            editText.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {}

                @Override
                public void afterTextChanged(Editable s) {
                    item.setEditableValue(s.toString());
                }
            });
        } else {
            convertView = layoutInflater.inflate(R.layout.multi_selection_checkbox, parent, false);
            checkBox = (CheckBox) convertView;
        }
        checkBox.setText(item.getLabel());
        checkBox.setChecked(item.isSelected());
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                item.setIsSelected(isChecked);
            }
        });

        return convertView;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return items.get(position).getId();
    }
}
Mehdiway
  • 8,380
  • 7
  • 29
  • 66

2 Answers2

0

I solve this by adding

android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

to the mainfest file.

Abhishek c
  • 484
  • 5
  • 14
-1

You could try the solution proposed in here. Basically setting up the SoftInputMode; like this: dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

Community
  • 1
  • 1
Xdsasdf
  • 74
  • 5