I have a problem with my app crashing when i try this code? I want i to constantly checking for if the MediaPlayer (MP) is playing, and if it is I want a Text to read "Now Playing" - But if it aint playing i want it to read "Not Playing".
I dont get any warnings from Eclipse, but still when i export it, it crashes on load. I know the code for setting the TextView isnt there but that isnt the problem. ( i think ) If there is an other way to do this i would be glad for a push in the right direction.
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//The Timer
Thread playingtimer = new Thread (){
public void run() {
try{
int time = 1;
while(time > 0) {
sleep(100);
if (MP.isPlaying()){
//set the TextView here "Now Playing"
}
else
//set the TextView to "NOT Playing"
}
}
catch (InterruptedException e) {
e.printStackTrace();
}
finally{
}
}
};
playingtimer.start();