I am developing an music player app. All works fine except the app dies suddenly. Sometimes this happens when the app starts, and sometimes after running for long time. Some
I found out the problem.
I had been initializing a Visualizer class which object inside the onPrepareListener() of a media player.
So whenever media player was calling prepare() function, the Visualizer object had been created again and again, thus it affected the memory and resulted into app die.
Removing the Visualizer initialization code from onPrepareListener() and initializing the object only once solved the problem. Now the app no longer crashes.