以下是布局的xml:的EditText没有返回预期值
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/T1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1,2">
<TableRow>
<EditText android:text="Enter SKU Id"
android:id="@+id/E1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</EditText>
<Button android:text="Search"
android:id="@+id/B1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</TableRow>
</TableLayout>
我想获得的EditText
值。编辑文本的默认值是输入SKU Id,我将其更改为一些字符串,但使用下面的代码时仍然给我默认字符串。
E11 = (EditText) findViewById(R.id.E1);
sku = E11.getText().toString();
如何获取当前值?