I can't display any map, only empty squares
Closed this issue · 2 comments
GoogleCodeExporter commented
I have been trying for a long time now to make a map be displayed on an app
I've been trying to develop, but I only see empty squares and the markers for 2
locations (im planning to do some routing), how can I fix this?
my code looks like this:
MainActivity:
package com.example.routing;
import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.ResourceProxy;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
public class MainActivity extends Activity {
MyItemizedOverlay myItemizedOverlay = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
int markerWidth = marker.getIntrinsicWidth();
int markerHeight = marker.getIntrinsicHeight();
marker.setBounds(0, markerHeight, markerWidth, 0);
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
myItemizedOverlay = new MyItemizedOverlay(marker, resourceProxy);
mapView.getOverlays().add(myItemizedOverlay);
GeoPoint myPoint1 = new GeoPoint(0*1000000, 0*1000000);
myItemizedOverlay.addItem(myPoint1, "myPoint1", "myPoint1");
GeoPoint myPoint2 = new GeoPoint(50*1000000, 50*1000000);
myItemizedOverlay.addItem(myPoint2, "myPoint2", "myPoint2");
}
}
================================================================================
==
activity_main.xml
<RelativeLayout 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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
<org.osmdroid.views.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
tilesource="Mapnik"/>
</RelativeLayout>
================================================================================
====
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.routing"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.routing.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================================================
====
I've tried this on three different operating systems and always get the same
result, the jars that I'm using are these:
osmdroid-android-4.2.jar
slf4j-android-1.6.1-RC1.jar
Already added them to the Build path
It is a bit urgent so any help would be great.
Original issue reported on code.google.com by canario...@hotmail.com
on 3 Jul 2014 at 4:54
GoogleCodeExporter commented
LogCat displays several yellow texts:
VFY: unable to resolve static method 14: Landroid/animation/ValueAnimator; of
Float([F)Landroid/animation/ValueAnimator;
VFY: unable to resolve virtual method 6: Landroid/animation/Animator;.end ()V
VFY: unable to resolve virtual method 16: Landroid/animation/ValueAnimator;.s
tart ()V
VFY: unable to resolve instance field 22.
Original comment by canario...@hotmail.com
on 3 Jul 2014 at 5:02
GoogleCodeExporter commented
Please ask questions on the discussion group and post bugs on GitHub
Original comment by neilboyd
on 13 Aug 2014 at 12:38
- Changed state: Invalid