这行android的多个标记

时间:2015-01-29 07:45:16

标签: android

EditText et;

导致错误:Syntax error on token ";", { expected after this token 但我无法找到语法错​​误。请帮忙

private static final String Button = null;
    public Integer user_id;
    public String client_list_id;
    JSONArray listarray = null;
    ListView listview;
    ListView lv;
    Button bt;
    EditText et;
    lv = (ListView).findViewById(R.id.listview);
    bt= (Button).findViewById(R.id.manualbtn);
    et = (EditText).findViewById(R.id.editText1); 
    View v = null;

    ArrayList<HashMap<String, String>> firstList = new ArrayList<HashMap<String, String>>();
    ArrayList<HashMap<String, String>> allList = new ArrayList<HashMap<String, String>>();

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

        user_id = getArguments().getInt("user_id");

        bt.setOnClickListener(new View.OnClickListener() {

            @Override 
            public void onClick(View v) {
                // TODO Auto-generated method stub 

                lv.setVisibility(View.GONE);
                et.setVisibility(View.VISIBLE);

            } 
        });

    }

1 个答案:

答案 0 :(得分:1)

lv = (ListView).findViewById(R.id.listview); bt= (Button).findViewById(R.id.manualbtn); et = (EditText).findViewById(R.id.editText1);移动到onCreate()方法中。 并使用setContentView()方法在您的活动的onCreate()方法中使用适当的布局,其中您的edittext和其他视图是动态生成的视图,用于保存这些元素