I am trying to add an EditText programmatically after the user keys "enter" on the previous EditText.
i am coded to do almost anything after "enter" (ie; Toast, hideSoftInput), but cannot figure out how to create a new text. I constantly get an error "The constructor EditText(new View.OnKeyListener(){}) is undefined" Here is a snippet of the code. FYI, editText1 that is referenced below was created programatticaly and i manually setId(601). i would like the subsequesnt editTexts that are dynamically created to be ++ the previous editText (ie; editText1 id=601, editText2 id=602, etc.) <pre><code> editText1.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { //hide keyboard InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editText1.getWindowToken(), 0); EditText editText2=new EditText(this); return true; } return false; } }); </code></pre> Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en