import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import com.nhn.android.maps.NMapActivity;
import com.nhn.android.maps.NMapController;
import com.nhn.android.maps.NMapView;
import com.nhn.android.maps.NMapView.OnMapStateChangeListener;
import com.nhn.android.maps.NMapView.OnMapViewTouchEventListener;
import com.nhn.android.maps.maplib.NGeoPoint;
import com.nhn.android.maps.nmapmodel.NMapError;
import com.nhn.android.maps.overlay.NMapPOIdata;
import com.nhn.android.mapviewer.overlay.NMapOverlayManager;
import com.nhn.android.mapviewer.overlay.NMapPOIdataOverlay;
import com.nhn.android.mapviewer.overlay.NMapPOIdataOverlay.OnStateChangeListener;
import com.nhn.android.mapviewer.overlay.NMapResourceProvider;
public class MainActivityscreen2<NMapViewerResourceProivder, poiDataOverlay> extends NMapActivity implements
OnMapStateChangeListener, OnMapViewTouchEventListener, LocationListener{
public static final String API_KEY = "f100c4baaf84f8da86508fed2b8d483f";
NMapView mMapView = null;
NMapController mMapController = null;
LinearLayout MapContainer;
NMapView mapview;
double latPoit = 0;
double lngPoint = 0;
NMapViewerResourceProivder mMapViewerResourceProvider = null;
NMapOverlayManager mMapOverlayManager;
OnStateChangeListener onPOIdataStateChangeListener = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LocationManager manager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000,0,(LocationListener) this);
MapContainer = (LinearLayout)findViewById(R.id.maps);
// create map view
mMapView = new NMapView(this);
// set a registered API key for Open MapViewer Library
mMapView.setApiKey(API_KEY);
// set the activity content to the map view
setContentView(mMapView);
// initialize map view
mMapView.setClickable(true);
// register listener for map state changes
mMapView.setOnMapStateChangeListener(this);
mMapView.setOnMapViewTouchEventListener(this);
// use map controller to zoom in/out, pan and set map center, zoom level
// etc.
mMapController = mMapView.getMapController();
// use built in zoom controls
mMapView.setBuiltInZoomControls(true, null);
setContentView(R.layout.activity_main_activityscreen2);
Button bt = (Button)findViewById(R.id.List);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivityscreen2.this,MainActivityscreen3.class);
startActivity(intent);
finish();
// TODO Auto-generated method stub
}
});
}
private void showMyLocation(double latitude, double longitude){
NMapViewerResourceProvider mMapViewerResourceprovider = null;
NMapOverlayManager mOverlayManager;
mMapViewerResourceprovider = new NMapViewerResourceProivder(this);
mOverlayManager = new NMapOverlayManager(this, mapview, mMapViewerResourceprovider);
NGeoPoint myPoint = new NGeoPoint(longitude, latitude);
int markerId = NMapPOIflagType.PIN;
NMapPOIdata poiData = new NMapPOIdata(1, mMapViewerResourceprovider);
poiData.beginPOIdata(1);
poiData.addPOIitem(myPoint, "현재위치", markerId, 0);
poiData.endPOIdata();
NMapPOIdataOverlay poDataOverlay = mOverlayManager.createPOIdataOverlay(poiData, null);
poiDataOverlay.showAllPOIdata(0);
NMapController controller = mapview.getMapController();
controller.animateTo(myPoint);
}
빨간 부분에 애러가 뜨네요
NMapViewerResourceProvider는 Multiple markers at this line
- Cannot instantiate the type
NMapViewerResourceProivder
- Type mismatch: cannot convert from 라고 뜨고
showAllPOIdata는
The method showAllPOIdata(int) is undefined for the type poiDataOverlay
라고 하네요. 어느 부분이 문제죠?
그리고 어느부분을 고쳐야 하죠?