这种事情都会发生?奇迹啊。。高分悬赏...
public void locationUpdated(LocationProvider lp , final Location location)
{
if(location.isValid())
{
Coordinates coordinates = location.getQualifiedCoordinates() ;
if(coordinates != null)
{
double latitude = coordinates.getLatitude() ;
double longitude = coordinates.getLongitude() ;
try
{
rmso.save(latitudeString+longitudeString) ;
}
catch(Exception e)
{
rmso.deleteRecordStore() ;
e.printStackTrace();
}
}
}
}
RMS封装类:
public void save(String info) throws RecordStoreFullException , RecordStoreNotFoundException , RecordStoreException
{
if(recordStore == null)
{
recordStore = RecordStore.openRecordStore(this.storeName , true) ;
}
byte[] byt = info.getBytes() ;
int recordNum = recordStore.getNumRecords() ;
if(recordNum == 0)
{
recordStore.addRecord(byt , 0 , byt.length) ;
}
else
{
recordStore.setRecord(1 , byt , 0 , byt.length) ;
}
recordStore.closeRecordStore() ;
}
问题: 为什么我在 locationUpdated 方法中调用 rms 封装类的save方法,我的nokia5800就只执行一次而如果我注释掉save方法的调用它就能正常执行呢?
rms 不是线程安全的吗。 何况也就这一个 类线程 在调用啊。 哪位仁兄帮帮忙看看。...