これが私のコードです。はTextviews
2 つのグループに分けられ、一方のグループが他方よりも優れている必要があります
public void onLocationChanged(Location location)
{
// TODO Auto-generated method stub
if(predictionFlag)
{
longitude = location.getLongitude();
latitude = location.getLatitude();
predictionFlag = false;
}
int x = 0;
do
{
if(x != 0)
{
try
{
Thread.sleep(100);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
Location predicationPoint = DOTGpsAppUtils.predictionAlgorithm(latitude, longitude, 1, 100);
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.oneSecondCalculatedPointLongitude);
textView.setText(Double.valueOf(predictionLongitude).toString());
if(x == 9)
{
longitude = predictionLongitude;
latitude = predictionLatitude;
}
System.out.println(x);
++x;
}while(x < 10);
TextView textView = (TextView) findViewById(R.id.startingPointLongitude);
textView.setText(Double.valueOf(location.getLongitude()).toString());
textView = (TextView) findViewById(R.id.startingPointLatitude);
textView.setText(Double.valueOf(location.getLatitude()).toString());
textView = (TextView) findViewById(R.id.oneSecondCalculatedPointLongitude);
textView.setText(Double.valueOf(longitude).toString());
textView = (TextView) findViewById(R.id.oneSecondCalculatedLatitude);
textView.setText(Double.valueOf(latitude).toString());
++y;
System.out.println("Thread Count:" + y);
}
なぜ Android 画面で が更新されないのか不思議に思ってい R.id.oneHundredmilliesecand
ますtextviews
。画面をより速く更新できるはずだと思うからです。