本帖最后由 chrisiguy 于 2011-11-27 13:51:03 编辑

解决方案 »

  1.   

    l.add(et.getText().toString());在这句之前添加一个et=(EditText)findViewById(R.id.et);
    试试看行不行。我感觉应该是变量的作用域问题,好像内部类在编译的时候跟类是平级的。
      

  2.   

    谢谢!但是不行哦!
    我猜是不行的,因为我点按钮后,View的文字消失了,就是说
    public void onClick(View v){
    l.add(et.getText().toString());
    et.setText("");
    actv.setText("");
    }
    后两句有效。
      

  3.   

    那如果你在
    l.add(et.getText().toString());
    et.setText("");
    这两句之间加上一句
    system.out.println(et.gettext)_tostring());这样的话你估计会输出什么呢?
      

  4.   

    Print出我输入在EditText里面的东西!
    所以getText是没问题的
    我把beforeclick的码也贴上来,你帮我看看可以吗??<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" > <TextView
        android:id="@+id/tx"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Input"
        ></TextView> <EditText
        android:id="@+id/et"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >     <requestFocus />
    </EditText> <Button
        android:id="@+id/bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" /> <AutoCompleteTextView
        android:id="@+id/actv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        /></LinearLayout>
      

  5.   

    你好!
    我用for语句循环Toast List里面的东西
    发现输入的字符会进入List
    只是AutoCompleteTextView没有出现而已
    不知道是为什么??
      

  6.   

    我估计应该是 onStart() 跟  onResume() 之间的区别。你想,你第一次运行这个Activity的时候已经完成对actv.setAdapter(aa);的设置了。那么当你再次调用的时候,实际上这个onStart()体里面的东西应该就不会再次执行了,而是执行onResume()里面的东西了,所以你试试复写onResume(),在这里面使用actv.setAdapter(aa);对它进行设置。看看能不能解决。希望能够帮到你。
      

  7.   

    试过了,不是哦
    不过我觉得两者应该没差,因为我只是在onStart设定OnClickListener而已
    而OnClickListener的执行应该跟OnStart或者OnResume没关系
    我觉得应该是List.add的问题
      

  8.   

    try aa.notifyDataSetChanged() after  l.add(et.getText().toString());