小编Hen*_*rik的帖子

从EditText获取文本字符串?

似乎我无法弄清楚如何获取文本字符串EditText.我想使用EditText按下按钮时的文字.

layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/popup_menu_root"
    android:background="#FFFFFF"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <Button android:id="@+id/popup_menu_button"
        android:text="ok"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <EditText
        android:id="@+id/edittext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的活动:

public class MyClass extends Activity {

  public String txtCheckin = "???";
  private String txtDescription = "???";
  private PopupWindow pw;

  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // get the instance of the LayoutInflater
    LayoutInflater inflater = (LayoutInflater) MyClass.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // inflate our view from the corresponding XML file
    final View layout = …
Run Code Online (Sandbox Code Playgroud)

java android android-edittext

42
推荐指数
3
解决办法
9万
查看次数

标签 统计

android ×1

android-edittext ×1

java ×1