解决方案 »
- 关于android google地图定位问题。
- 非空byte[] 转换成 bitmap ,bitmap 为空
- 无法监听KeyEvent.KEYCODE_POWER和KeyEvent.KEYCODE_HOME
- cocos2d android 该怎么下手?求高人指点…
- android如何在onActivityResult中触发BUTTON事件??
- android 如何listview显示图片文件的缩略图?
- ListView中不同项的按钮点击冲突
- Android CTS4.4_r3 测试时到这些测试项时老是错误怎么办啊?
- 小米的那种时间控件怎么实现的
- 用phpstudy做的手机软件,客户ip超过一定时间就无法连接服务器
- boot.img,解包ramdisk.gz和kernel后,ramdisk.gz无法解压
- jquery mobile 筛选框问题
试试看行不行。我感觉应该是变量的作用域问题,好像内部类在编译的时候跟类是平级的。
我猜是不行的,因为我点按钮后,View的文字消失了,就是说
public void onClick(View v){
l.add(et.getText().toString());
et.setText("");
actv.setText("");
}
后两句有效。
l.add(et.getText().toString());
et.setText("");
这两句之间加上一句
system.out.println(et.gettext)_tostring());这样的话你估计会输出什么呢?
所以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>
我用for语句循环Toast List里面的东西
发现输入的字符会进入List
只是AutoCompleteTextView没有出现而已
不知道是为什么??
不过我觉得两者应该没差,因为我只是在onStart设定OnClickListener而已
而OnClickListener的执行应该跟OnStart或者OnResume没关系
我觉得应该是List.add的问题