62,614
社区成员
发帖
与我相关
我的任务
分享
public class dz extends Activity implements OnClickListener {
/** Called when the activity is first created. */
EditText priceinput;
EditText discount;
Button btncalc;
TextView textView;
//Button btnShowDialog_Layout;
Button b_calc;
Button b_bztz;
Button b_gotg;
Spinner s1 ;
View myView;
int isloaging=0;
ProgressDialog progressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
this.setTitle("Lee's tool");
setContentView(R.layout.login);
// setContentView(R.layout.main);
LayoutInflater mInflater = LayoutInflater.from(this);
myView = mInflater.inflate(R.layout.main, null);
Thread thread = new Thread(){
public void run(){
try {
Thread.sleep(2000);
Message m = new Message();
m.what=1;
dz.this.mHandler.sendMessage(m);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
};
thread.start();
this.priceinput=(EditText)myView.findViewById(R.id.edtInput);
this.discount=(EditText)myView.findViewById(R.id.edtInput2);
this.btncalc=(Button)myView.findViewById(R.id.btnShow);
this.b_bztz=(Button)myView.findViewById(R.id.btnbztz);
this.b_gotg=(Button)myView.findViewById(R.id.btnClear);
this.b_gotg.setOnClickListener(this);
this.btncalc.setOnClickListener(this);
this.b_bztz.setOnClickListener(this);
this.textView=(TextView)myView.findViewById(R.id.TextView03);
this.s1 = (Spinner) findViewById(R.id.citys);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.fujian, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.s1.setAdapter(adapter);注1
}
private Handler mHandler = new Handler(){
public void handleMessage(Message msg) {
if (msg.what==2)
{
String st = msg.getData().getString("St");
dz.this.textView.setText(st);
progressDialog.dismiss();
}
if (msg.what==1)
{ setContentView(myView);
}
}
};