当前位置: 动力学知识库 > 问答 > 编程问答 >

How to get the text typed in an EditText for android using Python?

问题描述:

I used the xml below to design the layout of my android app. I used the EditText field to get an input from the user.

<EditText android:layout_width="match_parent"

android:layout_height="wrap_content"

android:id="@+id/editText1"

android:tag="Tag Me"

android:inputType="text">

<requestFocus></requestFocus>

</EditText>

How do I get the text typed in that EditText and print it using Python?

网友答案:

You can't use Python, Android programming is done in Java. You can get the text from the EditText as follows (in Java):

EditText et = (EditText)findViewById( R.id.editText1 );
String s = et.getText().toString();

If you're asking how to send that text to a webserver that uses Python, that's quite a bit more complicated.

分享给朋友:
您可能感兴趣的文章:
随机阅读: