title: Offline routing in android
body: <p>I'm trying to develop an android app to work with offline maps. Thanks to some help, i've created the map, and i've been able to load the maps offline.</p>
  
  <p>Now i'm trying to create routes, but i havent understood quite well how to do it.</p>
  
  <p>If i'm correct, i have to use an <a href="http://wiki.openstreetmap.org/wiki/OSM_XML" rel="nofollow">osm</a> file that has node's, way's and relation's like described <a href="https://wiki.openstreetmap.org/wiki/Elements" rel="nofollow">here</a>.</p>
  
  <p>My question is, how can i load this file's data to my app? I haven't been able to find any example of how to load this data to an app. All i've discovered is that this osm file can be converted to a smaller pbf file.</p>
  
  <p>Can anyone explain me how to use this osm data? Can anyone give me an example? Or am i taking a wrong approach?</p>
  
  <p>This code loads a OSM file with 700kb, but it doenst load mine because it has 99MB.</p>
  
  <pre><code>               // create the factory
             SAXParserFactory factory = SAXParserFactory.newInstance();
             // create a parser
             SAXParser parser = factory.newSAXParser();
  
             // create the reader (scanner)
             XMLReader xmlreader = parser.getXMLReader();
  
             // assign our handler
             xmlreader.setContentHandler(osmHandler);
  
  
             xmlInputStream = context.getResources().openRawResource(R.raw.lisboa);
             //xmlInputStream = context.getResources().openRawResource(R.raw.milano);
             //xmlInputStream = new FileInputStream(new File(Environment.getExternalStorageDirectory()+File.separator+"MyMaps","Lissabon.osm"));
  
             xmlreader.parse(new InputSource(xmlInputStream));
             osmHandler.isLoaded=true;
  </code></pre>
  
  <p>I'm using osmbonuspack_v3.4 and osmdroid_3.0.10.</p>
  
  <p>Thanks</p>