下面是我的代码,它在模拟器中运行得很完美但在htc
中根本不起作用 void run()
{
long updateStart=System.currentTimeMillis();
long comapartime=(updateStart+30000);
while((currentByte=stream.read())!=-1)
{
bytesIn++;
if(System.currentTimeMillis()>=comapartime) \\always gives false in device but gives true in emulator
{
updateStart=System.currentTimeMillis();
comapartime=(updateStart+30000);
}
}
}
答案 0 :(得分:0)
试试这个:
void run()
{
long updateStart=System.currentTimeMillis();
long comapartime=(updateStart+30000);
while((currentByte=stream.read())!=-1)
{
bytesIn++;
long tmp = System.currentTimeMillis(); // set a break point here, is it returning 0 on device?
if(tmp>=comapartime) \\always gives false in device but gives true in emulator
{
updateStart=System.currentTimeMillis();
comapartime=(updateStart+30000);
}
}
}