Note that there are some explanatory texts on larger screens.

plurals
  1. POOSMDroid simple example required
    primarykey
    data
    text
    <p>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.</p> <p>I have been directed to these examples: <a href="http://code.google.com/p/osmdroid/source/browse/#svn%2Ftrunk%2FOpenStreetMapViewer%2Fsrc%2Forg%2Fosmdroid%2Fsamples" rel="noreferrer">http://code.google.com/p/osmdroid/source/browse/#svn%2Ftrunk%2FOpenStreetMapViewer%2Fsrc%2Forg%2Fosmdroid%2Fsamples</a></p> <p>but I am struggling to follow them as I am new to both java and android.</p> <p>I have created a class file called test (which I have created following an example!):</p> <pre><code>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)); } </code></pre> <p>}</p> <p>with a layout file:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;org.osmdroid.views.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" tilesource="MapquestOSM" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>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.</p> <p>UPDATE: I also have the following in my manifest file:</p> <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>Can anyone help?</p> <p>Bex</p> <p><strong>Solution</strong> Make sure the position of the permissions is in the correct place in the manifest!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload