Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4067748
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:17:20+00:00 2026-05-20T16:17:20+00:00

I am trying to create an app that uses offline maps and custom tiles.

  • 0

I am trying to create an app that uses offline maps and custom tiles.
For this I have decided to use OSMDroid and have included the jar within my project.
I will create my custom tiles using MOBAC.

I have been directed to these examples: http://code.google.com/p/osmdroid/source/browse/#svn%2Ftrunk%2FOpenStreetMapViewer%2Fsrc%2Forg%2Fosmdroid%2Fsamples

but I am struggling to follow them as I am new to both java and android.

I have created a class file called test (which I have created following an example!):

public class test extends Activity {
/** Called when the activity is first created. */

 protected static final String PROVIDER_NAME = LocationManager.GPS_PROVIDER;

 @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    MapView map = (MapView) findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.MAPQUESTOSM);

    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);
    map.getController().setZoom(16);
    map.getController().setCenter(new GeoPoint(30266000, -97739000));

}

}

with a layout file:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <org.osmdroid.views.MapView android:id="@+id/map"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        tilesource="MapquestOSM" android:layout_weight="1" />
</LinearLayout>

When I run this I see no map, just an empty grid.
I think this is due to my tilesource but I’m not sure what I need to change it to.

UPDATE:
I also have the following in my manifest file:

<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" />

Can anyone help?

Bex

Solution
Make sure the position of the permissions is in the correct place in the manifest!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:17:21+00:00Added an answer on May 20, 2026 at 4:17 pm

    This one worked for me:

    setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);   
    

    as did:

    setTileSource(TileSourceFactory.MAPNIK);
    

    I didn’t need to have anything in the the XML

    It’s coming back to be now, I had to add one of these:

    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission
        android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission
        android:name="android.permission.ACCESS_NETWORK_STATE"/>
    

    to the manifest.xml.

    I can’t remember which one was necessary but if you put all 3 in, it should work.

    Well here’s my entire source, which I’ve just run on the emulator:

    package com.nbt.osmdroidtest;
    
    import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
    import org.osmdroid.util.GeoPoint;
    import org.osmdroid.views.MapController;
    import org.osmdroid.views.MapView;
    import android.app.Activity;
    import android.os.Bundle;
    
    public class OsmDroidTest extends Activity {
        /** Called when the activity is first created. */
        private MapController mapController;
        private MapView mapView;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            mapView = (MapView) findViewById(R.id.mapview);
            mapView.setTileSource(TileSourceFactory.MAPNIK);
            mapView.setBuiltInZoomControls(true);
            mapController = mapView.getController();
            mapController.setZoom(15);
            GeoPoint point2 = new GeoPoint(51496994, -134733);
            mapController.setCenter(point2);
        }
        protected boolean isRouteDisplayed() {
            // TODO Auto-generated method stub
            return false;
        }
    }   
    

    Give it a minute or so to load, as initially it might be quite slow in building up a cache.
    Those coordinates should put you over central London. If you still have problems see if there is anything illuminating in the logcat.

    And the main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <org.osmdroid.views.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
    
    />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple offline application for personal-use that uses a
I'm trying to create a simple Java app that uses JNI to call some
I'm trying to create a C# form app that will allow me to use
I'm trying to create a rails web app that does not use ActiveRecord framework
what i'm trying to do this this. Simply create a C# windows app that
I am trying to create a simple 3-D app for android that will have
I want to create an app that uses the internet and I'm trying to
Hi I m trying to create app that uses user's profile pic in it.
recently I been trying to create an android app that uses JSON Objects to
I'm trying to create some Functional tests for a Django app that uses South

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.