Note that there are some explanatory texts on larger screens.

plurals
  1. POTextWatch in ArrayAdapter
    text
    copied!<p>I have an ArrayAdapter and I'm using TextWatcher for control change in some TextView, but I have a problem. I dont know how to selected editable view after change. I tried to add a OnClickListener and have some profit, but to all works well I need first of all click on View and when on TextView</p> <pre><code>ViewHolder holder; @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.item_row, null); holder = new ViewHolder(); holder.value = (EditText) convertView.findViewById(R.id.value); holder.item = (TextView) convertView.findViewById(R.id.item); holder.relust = (TextView) convertView.findViewById(R.id.result); convertView.setOnClickListener(this); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.item.setText(items.get(position) + ""); holder.position = position; return convertView; } @Override public void afterTextChanged(Editable text) { if (text.length() != 0) { Double value = Double.valueOf(text.toString()); Double result = value * 2; holder.relust.setText("= " + result + " sm"); } } @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 onClick(View v) { holder = (ViewHolder) v.getTag(); holder.value.addTextChangedListener(this); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload