2010-12-11 3 views
0

アクティビティの作成中にTimertaskを開始しています。タイマータスクはマイク入力を聴き、サウンド周波数を決定します。周波数が特定の範囲を超えているときは、メッセージとともにDialogboxを表示する必要があります。次のコードは良く見えますが、DIalogボックスはポップアップしません。任意の提案をいただければ幸いです。タイマータスクのダイアログボックス

+1

がエラーがある、またはコントロールが..... – viv

+0

んが、エラーをチェックしないようにしようと、ログを置くと、このタイマーの内部で起こっている..私をパズル厥 – Ananth

答えて

1

私はそれを解決するためにハンドラを使用しました。

1

このようなハンドラを使用しました。

public class Lessons extends Activity{ 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 

    setContentView(R.layout.lessons); 

    Handler handler = new Handler(); 

    handler.postDelayed(new Runnable() { 
     public void run() { 
      Dialog dialogLessons = new Dialog(Lessons.this); 
      dialogLessons.setContentView(R.layout.test_dialog_box); 
      dialogLessons.setTitle("Lesson test dialog title"); 
      dialogLessons.setCancelable(false); 

      TextView text = (TextView) 
        dialogLessons.findViewById(R.id.textView1); 
      text.setText(R.string.lots_of_text); 

      dialogLessons.show(); 

     } 
    }, 2000); 
} 

}

関連する問題