TextView textView1;
int iCont=0;
private Thread mThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_function_weather);
textView1=(TextView)findViewById(R.id.textView_weather);
if(mThread==null){
mThread=new Thread(runnable);
mThread.start();//Ïß³ÌÆô¶¯
}
else
{
Toast.makeText(FunctionWeatherActivity.this,"Runing",Toast.LENGTH_SHORT);
}
}
Runnable runnable=new Runnable() {
@Override
public void run() {//run()ÔÚеÄÏß³ÌÖÐÔËÐÐ
mHandler.obtainMessage(1).sendToTarget();
}
};
private Handler mHandler=new Handler(){
public void handleMessage(Message msg){//´Ë·½·¨ÔÚuiÏß³ÌÔËÐÐ
switch (msg.what){
case 1:
textView1.setText("1");
break;
case 2:
textView1.setText("2");
break;
default:
textView1.setText("default");
break;
}
}
};