2

Thanks for reading.

I am facing a problem where when I start a new Activity in my TabHost, the new Activity only shows up for a few seconds before returning to the default Activity in that Tab.

I am using the TabHost for laying out 5 tabs in my app. In one of the tabs, I start a new Activity as follows:


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() );

In this NewActivitys' onCreate(), I am calling a speech recognition libraries' startRecord() method which is implemented as follows:


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

All I know is there is a SpeechFrameworkActivity associated with this library in the AndroidManifest.xml.

If I comment out calling the startRecord() method, the NewActivity does not disappear and continues to show.

I am just clueless about what is going wrong.

From the logs, all I see is this one line:


09-21 21:16:44.860: DEBUG/PhoneWindow(6737): couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@4794d9b8 has no id.

I tried using onConfigurationChanged() in my MainTabActivity but that didn't solve the problem.

Please help! Any help/pointers would be great appreciated!

Sagar Hatekar
  • 8,700
  • 14
  • 56
  • 72

1 Answers1

1

this may happen due to less memory in my case i clear the memory every time before using and it work may be in ur case it works or use system.gc or clear buffer just try this if it helps u .

unkown
  • 1,100
  • 5
  • 18
  • 39