I've got a problem with my EditText
. I use the following adapter:
public class RowTextViewAdapter extends BaseAdapter {
...
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (rowTitles.get(position).equals("edit")) {
if(et == null){
et = new EditText(activity);
et.setText("Test");
}
return et;
}
else {
convertView = new TextRow(activity);
holder = new ViewHolder(((TextRow) convertView).getTextView(), ((TextRow) convertView).getImageView());
convertView.setTag(holder);
holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity));
holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null));
return convertView;
}
}
}
and ListActivity
:
public class AppSettingActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
adapter = new RowTextViewAdapter(this);
adapter.addRowView("account", "arrowDw");
adapter.addRowView("password", "arrowDw");
setListAdapter(adapter);
}
...
protected void onListItemClick(ListView listView, View view, int position, long id) {
switch (position) {
case 0: accIsEditable = adapter.setEditable(position); break;
case 1:
if(accIsEditable) {
//TODO do something..
break;
}
pwIsEditable = adapter.setEditable(position);
break;
...
}
}
If i click on the first item I add a new list item on pos. 1 (pos: 0, 1, 2, ...).
Now the EditText
field is added to the list.
ListView:
---------------------------- -------------------------
Account v Account ^
---------------------------- ==> -------------------------
Passowrd v [::::::::EditText:::::::]
---------------------------- -------------------------
//more.. Password v
---------------------------- -------------------------
//more..
-------------------------
If I click now into the EditText
field, it shows the virtual keyboard and loses focus of the EditText
. I click again and it gains focus. But if I write something, the text is only showed in the EditText
field, if i tap on it and not frequently while i'm writing...
Any idea to fix that update problem?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With