In Android, how can I set the value of a edit box in WebView using Javascript

后端 未结 4 1508
醉酒成梦
醉酒成梦 2021-02-09 14:27

I understand how to set the value of a edit box in WebView, and in a browser on PC with Javascript.

It is basically first find out the ID of the edit box (text), then s

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-09 15:02

    Use the setText() function of TextView as in:

    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText(message);
    

    Where 'message' is a String variable, this will put the value of message into the textView box replacing anything that was in there previously. I got this example from the code at the bottom of this page https://developer.android.com/training/basics/firstapp/starting-activity.html

    EditText uses the same setText() method

提交回复
热议问题