You are not logged in.
- Topics: Active | Unanswered
Announcement
*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***
Pages: 1
#1 2016-10-30 10:46:52
- reqlo
- Member
- Registered: 2016-10-30
- Posts: 4
Karte wird nicht angezeigt
Hallo,
ich versuche eine App zu programmieren, die osm benutzt. Ich habe dabei das Problem, dass die Karte nicht angezeigt wird, sondern ein View mit einem Gitter. Wie ich gefunden habe, haben schon einige dieses Problem gehabt, jedoch keine befriedigende Antwort darauf erhalten.
Mein Code:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ViewGroup;
import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.MyLocationOverlay;
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
public class Main extends AppCompatActivity {
private MapView mapView;
private MyLocationOverlay myLocationOverlay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = new MapView(this,256, new DefaultResourceProxyImpl(this));
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.getController().setZoom(16);
mapView.getController().setCenter(new GeoPoint(52.221, 6.893));
ViewGroup container = (ViewGroup)findViewById(R.id.container);
container.addView(mapView);
myLocationOverlay = new MyLocationOverlay(getApplicationContext(),mapView);
myLocationOverlay.enableMyLocation();
mapView.getOverlays().add(myLocationOverlay);
}
}Das xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.lothar.karte.Main">
</FrameLayout>Das Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lothar.karte">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<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" />
</manifest>Und schließlich build
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.lothar.karte"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/slf4j-android-1.5.8.jar')
compile files('libs/osmdroid-android-3.0.10.jar')
}In libs stehen die unter dependencies genannten jar-files
Ich hoffe, mir kann jemand helfen.
mfg
reqlo
Offline
#2 2018-09-16 09:45:54
- funda42
- New Member
- Registered: 2018-09-16
- Posts: 1
Re: Karte wird nicht angezeigt
Hallo,
konnten Sie das Problem zwischenzeitlich lösen? Ich kämpfe ebenfalls damit.
Gruß,
Funda42
Offline
#3 2018-09-16 12:29:54
- toc-rox
- Member

- From: Münster
- Registered: 2011-07-20
- Posts: 2,357
- Website
Re: Karte wird nicht angezeigt
Einen zwei Jahre alten Thread ohne Response wiederzubeleben, dürfte wenig bringen. Vielmehr solltest du deine Problemstellung genauer beschreiben.
Offline
Pages: 1