私はアンドロイドアプリケーションに取り組んでいます。私の活動では、次のコードを使用しています。
LocationResult locationResult = new LocationResult(){
@Override
public void gotLocation(Location location){
//Got the location!
Drawable marker = getResources().getDrawable(
R.drawable.currentlocationmarker);//android.R.drawable.btn_star_big_on
int markerWidth = marker.getIntrinsicWidth();
int markerHeight = marker.getIntrinsicHeight();
marker.setBounds(0, markerHeight, markerWidth, 0);
MyItemizedOverlay myItemizedOverlay = new MyItemizedOverlay(marker);
currentmarkerPoint = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
currLocation = location;
mBlippcoordinate = currentmarkerPoint;
mBlippLocation = location;
myItemizedOverlay.addItem(currentmarkerPoint, "", "");
mBlippmapview.getOverlays().add(myItemizedOverlay);
animateToCurrentLocation(currentmarkerPoint);
}
};
MyLocation myLocation = new MyLocation();
myLocation.getLocation(this, locationResult);
上記のコードを使用して、GPS またはネットワークから位置を検索しています。animateToCurrentLocation(currentmarkerPoint);
メソッドには asynctask が含まれています。
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
前もって感謝します。