I'm trying to restrict the map view for OSM given the 4 points to act as corers.
In reference to this question, I am also trying to use the BoundedMapView.java (got from this website) to help me with this.
This is my activity codes:
public class POfflineMapView extends Activity implements LocationListener, MapViewConstants{
private BoundedMapView myOpenMapView;
//... removed unreleated variables
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
setContentView(R.layout.offline_map_activity);
myOpenMapView = (BoundedMapView) findViewById(R.id.openmapview);
myOpenMapView.getTileProvider().clearTileCache();
//removed unlreleated codes
BoundingBoxE6 bbox = new BoundingBoxE6(north,east,south,west);
myOpenMapView.setScrollableAreaLimit(bbox);
}
}
This is my xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<entity.BoundedMapView
android:id="@+id/openmapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
My LogCat shows this error:
12-28 17:24:11.830: E/AndroidRuntime(14459): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
I'm unsure why I am still getting this error; the BoundedMapView is extended from the MapView class, why is it still having an error for the Constructor?
Kindly enlighten if I do not seem to be interpreting this error correctly, thanks!
It's because when you create a BoundedMapView
in xml code, it calls this constructor, which is missing:
public BoundedMapView(final Context context, final AttributeSet attrs) {
super(context, 256, new DefaultResourceProxyImpl(context), null, null, attrs);
}