除了判断player是否等于null,还要判断isplaying,否者报错public void run() {
// TODO Auto-generated method stub
boolean isTrue=
true;
while(isTrue=
true){
try{
Thread.sleep(1000
);
}catch(InterruptedException e){
e.printStackTrace();
}
if(player==
null){
isTrue=
false;
}else{
if(player.isPlaying()){//这是插入的代码
int position=
player.getCurrentPosition();
Message msg=
handler.obtainMessage();
msg.what=
position;
handler.sendEmptyMessage(position);
}
}
}
转载于:https://www.cnblogs.com/wdc224/p/3801480.html
转载请注明原文地址: https://mac.8miu.com/read-70427.html