对所有人都好我有一个问题,我需要知道如何使用asynctask中的代码,如果有人可以向我解释如何转移我在其中的代码,我对asynctask的理解不是很好我非常感谢asynctask的处理程序。
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (polylanelist2.size() > 1 ){
if (index < polylanelist2.size() - 1) {
index++;
next = index + 1;
}
if (index < polylanelist2.size() - 1) {
starposition = polylanelist2.get(index);
endposition = polylanelist2.get(next);
}
valueAnimator = ValueAnimator.ofFloat(0, 1);
valueAnimator.setDuration(3000);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
v = valueAnimator.getAnimatedFraction();
logg = v * endposition.longitude + (1 - v)
* starposition.longitude;
latt = v * endposition.latitude + (1 - v)
* starposition.latitude;
newpos = new LatLng(latt, logg);
marker.setPosition(newpos);
marker.setAnchor(0.5f, 0.5f);
marker.setRotation(getBearing(starposition, newpos));
}
});
valueAnimator.start();
handler.postDelayed(this, 3000);
}
}
},3000);