Android 文本视图';谷歌在安卓上的落后
这是我的密码。Android 文本视图';谷歌在安卓上的落后,android,textview,Android,Textview,这是我的密码。文本视图分为两组,其中一组应优于另一组 public void onLocationChanged(Location location) { // TODO Auto-generated method stub if(predictionFlag) { longitude = location.getLongitude();
文本视图
分为两组,其中一组应优于另一组
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);
}
public void onLocation已更改(位置)
{
//TODO自动生成的方法存根
if(预测标志)
{
longitude=location.getLongitude();
纬度=位置。getLatitude();
predictionFlag=false;
}
int x=0;
做
{
如果(x!=0)
{
尝试
{
睡眠(100);
}捕捉(中断异常e)
{
e、 printStackTrace();
}
}
位置预测点=DOTGpsAppUtils.predictionAlgorithm(纬度,经度,1100);
双预测经度=(经度+预测点.getLength())/2;
双预测纬度=(纬度+预测点.getLatitude())/2;
TextView TextView=(TextView)findViewById(R.id.onehundAdminLiseCondLatitude);
textView.setText(Double.valueOf(predictionLatitude.toString());
textView=(textView)findViewById(R.id.OneSecondCalculatedPointLength);
textView.setText(Double.valueOf(predictionLongitude.toString());
如果(x==9)
{
经度=预测经度;
纬度=预测纬度;
}
系统输出println(x);
++x;
}而(x<10);
TextView TextView=(TextView)findViewById(R.id.startingpoint经度);
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.OneSecondCalculatedPointLength);
textView.setText(Double.valueOf(longitude.toString());
textView=(textView)findViewById(R.id.oneSecondCalculatedLatitude);
textView.setText(Double.valueOf(latitude.toString());
++y;
System.out.println(“线程计数:+y”);
}
我想知道为什么android屏幕上的
R.id.onehundredmilliescand
更新得更快,而另一个textview
更新得更快。因为我认为它应该能够更快地更新屏幕。因为所有这些都发生在UI线程上
当您在睡眠中耗尽UI线程时,框架没有机会运行并实际重新绘制整个内容。因为所有这些都发生在UI线程上 当用户界面线程使用睡眠时,框架没有机会运行并实际重新绘制整个内容。
线程。睡眠(100)
阻止用户界面线程,并且没有用户界面元素可以更新。线程。睡眠(100)
阻止用户界面线程,并且没有用户界面元素可以更新