APPでTTSを使用しています。onPuaseメソッドの実行中に、次のコードを使用してエンジンを停止します。問題は、ホームボタンを使用してアクティビティを一時停止すると、logcatセクションに貼り付けたときにエラーが発生することです。ログ猫(アクティビティcom.example.DragDrop.PlaySeriesがServiceConnectionをリークしました)から、問題は何らかのリークが原因であることがわかりました。ただし、問題はアプリを停止したり、機能を妨害したりすることではありません。しかし、私はこの問題の深刻さとこれを回避する方法を知りたいですか?
助けてください
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
Log.i("PlaySeries", "In pause play series");
if(tts !=null){
Log.i("PlaySeries", "In pause play series");
tts.stop();
// tts.shutdown();
}
}
@Override
protected void onDestroy() {
//Close the Text to Speech Library
if(tts !=null){
Log.i("PlaySeries", "In pause play series");
tts.stop();
tts.shutdown();
}
super.onDestroy();
}
とonCreateで
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.series);
tts = new TextToSpeech(this,this);
}
LogCat
03-22 10:46:45.205: E/ActivityThread(3881): Activity com.example.DragDrop.PlaySeries has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@2bbe5960 that was originally bound here03-22 10:46:45.205: E/ActivityThread(3881): android.app.ServiceConnectionLeaked: Activity com.example.DragDrop.PlaySeries has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@2bbe5960 that was originally bound here03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): android.app.ServiceConnectionLeaked: Activity com.example.DragDrop.PlaySeries has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@2bbe5960 that was originally bound here03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881): 03-22 10:46:45.205: E/ActivityThread(3881):
03-22 10:46:45.205: E/ActivityThread(3881):