开发者

getting text dynamically from EditableText android

开发者 https://www.devze.com 2023-01-22 09:55 出处:网络
i am trying to get the text input/values 开发者_如何学Cfrom an EditText widget as its being typed. please anybody know how or which method i should use? can\'t seem to find one that will help. thanks

i am trying to get the text input/values 开发者_如何学Cfrom an EditText widget as its being typed. please anybody know how or which method i should use? can't seem to find one that will help. thanks for your consideration.

i tried this but not working:

  Entry = (EditText)findViewById(R.id.typeEntryId);
          viewEntry = (TextView)findViewById(R.id.viewEntryId);

       if(Entry != null){
            //viewEntry.setText(Entry.getEditableText().toString());
                  viewEntry.setText(Entry.getText().toString());
        }


Use a TextWatcher.


EditText field = (EditText) findViewById(R.id.myField);
if ( field != null ) {
  Log.d ("myField",field.getText().toString());
}

you should be able to just do that. The getText() method returns an Editable type which implements CharSequence

0

精彩评论

暂无评论...
验证码 换一张
取 消