最初の数回でテキストビューが動かなくなることがありますが、その理由を誰か教えてください..特定のスレッドのテキストのみを更新する必要があると聞いたので、このスレッドを開始しました。
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