2011-09-22 57 views
2

感謝您的閱讀。TabHost在顯示新活動一段時間後顯示默認活動

我面臨着在那裏,當我在我的TabHost開始新Activity一個問題,新的Activity只顯示了幾秒鐘在Tab返回默認Activity之前。

我使用TabHost在我的應用程序中佈置5個選項卡。在其中一個選項卡,我開始一個新的Activity如下:


Intent intent = new Intent(this, NewActivity.class); 
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
LocalActivityManager manager = MyActivityGroup.ActivityGroup.getLocalActivityManager(); 
MyActivityGroup.ActivityGroup.replaceView(manager.startActivity("NewActivity", intent).getDecorView()); 

在這種NewActivity S'onCreate(),我打電話語音識別庫startRecord()方法,執行如下:


private void startRecognition() { 
     try { 
      recognizer.startRecord(new SpeechRecognizerEvent() { 
       @Override 
       public void onRecognitionComplete(SpeechResult result) { 
          //get result data 
       } 
} 

我所知道的是在AndroidManifest.xml中存在與此庫相關的SpeechFrameworkActivity

如果我註釋掉撥打startRecord()方法,NewActivity不會消失並繼續顯示。

我只是無知什麼是錯的。

從日誌中,我看到的是這樣的一行:


09-21 21:16:44.860: DEBUG/PhoneWindow(6737): couldn't save which view has focus because the focused view [email protected] has no id. 

我想在我的MainTabActivity使用但這並沒有解決問題。

請幫忙!任何幫助/指針將非常感謝!

回答

1

這可能會在我的情況下,由於發生更少的內存 我每次清空內存使用 前,它的工作可能是在烏拉圭回合情況下,它的工作原理 或使用的System.gc 或清除緩衝區只是試試這個,如果有幫助你好