import android.app.Activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class PlantNow extends Activity implements OnClickListener{
Button cd;
TextView tvcd;
public class MyCountDownTimer extends CountDownTimer {
public MyCountDownTimer(long startTime, long interval) {
super(startTime, interval);
}
@Override
public void onFinish() {
tvcd.setTextSize(30);
tvcd.setText("BOOOOOOOOM");
}
@Override
public void onTick(long millisUntilFinished) {
tvcd.setText("" + millisUntilFinished/1000);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//FullScreen Start
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
//FullScreen End
setContentView(R.layout.plantnow);
tvcd=(TextView)findViewById(R.id.tvcd);
cd=(Button)findViewById(R.id.b11);
cd.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()){
case R.id.b11:
tvcd.setTextSize(20);
tvcd.setText("Message Here");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MyCountDownTimer countDownTimer = new MyCountDownTimer(30000, 1000);
break;
}
}
这是当前的代码,我有,我也添加了新的 MyCountdowntimer 类,但它警告我我的帖子主要是代码,哦,天哪,为什么,我对 stackflow 有点陌生,它给了我很多问题 xD