有时我的文本视图在前几次后卡住了,谁能告诉我为什么.. 我开始这个线程是因为我听说你应该只更新某些线程中的文本,所以有人能告诉我为什么这个会坏吗?
Runnable updateTextRunnable=new Runnable(){
public void run() {
count++;
Location predicationPoint = DOTGpsAppUtils.predictionAlgorithm(latitude, longitude, bearing, distance);
Location currentLocation = new Location("current");
currentLocation.setLatitude(latitude);
currentLocation.setLongitude(longitude);
distance = DOTGpsAppUtils.distanceBetweenTwoLocations(currentLocation, predicationPoint);
bearing = DOTGpsAppUtils.headingBetweenTwoLocations(currentLocation, predicationPoint);
double predictionLongitude = (longitude + predicationPoint.getLongitude())/2;
double predictionLatitude = (latitude + predicationPoint.getLatitude())/2;
TextView textView = (TextView) findViewById(R.id.oneHundredMillisecondLatitude);
textView.setText(Double.valueOf(predictionLatitude).toString());
textView = (TextView) findViewById(R.id.oneHundredMillisecondLongitude);
textView.setText(Double.valueOf(predictionLongitude).toString());
textView = (TextView) findViewById(R.id.heading);
textView.setText(Double.valueOf(bearing).toString());
textView = (TextView) findViewById(R.id.speed);
textView.setText(Double.valueOf(distance).toString());
if(count >= 100)
{
count = 0;
}
longitude = predictionLongitude;
latitude = predictionLatitude;
handler.postDelayed(this, TIME_DELAY);
}
};
日志猫:
09-09 02:13:21.049: E/Trace(26898): error opening trace file: No such file or directory (2)
09-09 02:05:02.942: W/IInputConnectionWrapper(25579): getExtractedText on inactive InputConnection
09-09 02:05:02.983: W/IInputConnectionWrapper(25579): getExtractedText on inactive InputConnection
09-09 02:05:03.003: W/IInputConnectionWrapper(25579): getExtractedText on inactive InputConnection
09-09 02:05:25.216: D/dalvikvm(25579): GC_CONCURRENT freed 7915K, 52% free 8261K/16963K, paused 17ms+3ms, total 86ms
09-09 02:05:35.237: I/dalvikvm(25773): Turning on JNI app bug workarounds for target SDK version 7...
09-09 02:05:35.247: E/Trace(25773): error opening trace file: No such file or directory (2)
09-09 02:05:35.257: D/ActivityThread(25773): setTargetHeapUtilization:0.25
09-09 02:05:35.257: D/ActivityThread(25773): setTargetHeapIdealFree:8388608
09-09 02:05:35.257: D/ActivityThread(25773): setTargetHeapConcurrentStart:2097152