package com.example.kechengbiao;

import com.example.http.KVAsyncTask;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Fir_MainActivity extends Activity {

	private Button login_btn;
	private EditText id_Text,pwd_Text;
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fir_mainactivity);
		initView();
		initEvent();
	}

	private void initView() {
		login_btn = (Button) findViewById(R.id.fir_loginbtn);
		id_Text = (EditText) findViewById(R.id.fir_id_edittext);
		pwd_Text = (EditText) findViewById(R.id.fir_pwd_edittext);
		
	}

	private void initEvent() {
		login_btn.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
              String id = id_Text.getText().toString().trim();
              String pwd = pwd_Text.getText().toString().trim();
              if(id != null && pwd !=null && !id.isEmpty() && !pwd.isEmpty()){
            	  System.out.println("id:"+id+"  pwd£»"+pwd);
            	  KVAsyncTask kva = new KVAsyncTask(Fir_MainActivity.this,id, pwd);
            	  kva.execute();
              }
			}
		});
	}
}
