我有兩個問題,我在試圖學習的過程中從教程網站下面的代碼,並找出如何設置倒數計時器。但是當我在模擬器中啓動時,它在啓動之前崩潰並且android force關閉它。 所以這裏是我的兩個問題:如何使用Android Eclipse調試?一個簡單代碼的未知錯誤
1什麼,或者哪裏是導致錯誤的行? 2-I在onCreate方法上放置了斷點,並切換到調試器視圖,在這裏我無法知道如何在Eclipse中使用調試器視圖。在哪裏尋找錯誤的錯誤,以及爲什麼Eclipse調試器不突出顯示它正在停止的行?
我很樂意爲第二個問題得到更多答案。顯然:)
感謝任何人的幫助,或試圖幫助。
public class MytestActivity extends Activity {
/** Called when the activity is first created. */
TextView tv; //textview to display the countdown
//final TextView tv = (TextView) findViewById(R.id.editText1);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//final TextView tv = (TextView) findViewById(R.id.editText1);
tv = new TextView(this);
this.setContentView(tv);
//5000 is the starting number (in milliseconds)
//1000 is the number to count down each time (in milliseconds)
MyCount counter = new MyCount(5000,1000);
counter.start();
}; //end of onCreate class
//countdowntimer is an abstract class, so extend it and fill in methods
public class MyCount extends CountDownTimer{
public MyCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
tv.setText("done!");
}
@Override
public void onTick(long millisUntilFinished) {
tv.setText("Left: " + millisUntilFinished/1000);
}
} //end of MyCount class
} //End of activity class
我得到這個工作,但仍然不知道什麼是錯的。我的第二個問題仍然適用,如何在Android Eclipse中進行調試並按照與在C#中一樣的方式逐行停止,VB ..etc –