0
我開始創建活動的Timertask。計時器任務監聽麥克風輸入並確定聲音頻率。每當頻率超過一定範圍時,我需要顯示帶有消息的對話框。下面的代碼對我來說看起來不錯,但是DIalog框不會彈出。任何建議,將不勝感激定時器任務中的對話框
Context mContext = getApplicationContext();
System.err.println("Inside Dialog");
Dialog dialog = new Dialog(mContext);
dialog.setContentView(R.layout.entryofferdialog);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
// set up text
TextView text = (TextView) dialog.findViewById(R.id.TextView01);
text.setText(":LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
// set up button
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
// now that the dialog is set up, it's time to show it
dialog.show();
}
是否有任何錯誤,或者在控制走這裏面計時器,把日誌,然後嘗試檢查..... – viv 2010-12-11 05:48:49
沒有錯誤..那是什麼讓我爲難 – Ananth 2010-12-11 14:56:12