Please note thatArticlePlease indicate the source when Reprinting
Http://blog.csdn.net/shuaiyinoo》thank you
When writing this blog, you need to first note that multiple navigation lines are displayed on the map, whether for a walking line or a driving route, or public transportation routes are also applicable.
The implementation of this multiple lines is only a little different from that of a display, but only adds a loop. Let's take a look.
The specific implementation is as follows:
The first step is to add the following content to the oncreate method like the previous blogs.Code
// Search mapcontroller for Multiple Route entries at v9.00. setzoom (14); // search for objects within the MAP range mksearch = new mksearch (); mksearch. init (bmapmanager, new mysearchlistener (); // specify the first coordinate start = new mkplannode (); start.pt = new geopoint (INT) (39.915*1e6), (INT) (116.404*1e6); // specify the Second coordinate end = new mkplannode (); end.pt = new geopoint (40057031,2017307852); // call the route callback method mksearch. transitsearch ("Beijing", start, end );
The following method is implemented in the interface implemented by mysearchlistener implements mksearchlistener:
@ Overridepublic void ongettransitrouteresult (mktransitrouteresult result, int type) {// callback Method for Public Transit transfer // v7.00 // If (result = NULL) {// return; /// transitoverlay = new transitoverlay (baidu_suyiactivity.this, mapview); // transitoverlay. setdata (result. getplan (0); // mapview. getoverlays (). add (transitoverlay); // refresh the map // mapview. invalidate (); // v9.00if (result = NULL) {return ;}// obtain all driving routes. Int plannum = result. getnumplan (); For (INT I = 0; I <plannum; I ++) {transitoverlay = new transitoverlay (baidu_suyiactivity.this, mapview); transitoverlay. setdata (result. getplan (I); mapview. getoverlays (). add (transitoverlay);} mapview. invalidate (); mapview. getcontroller (). animateto (result. getstart (). pt );}
The above method compares and does not use the v7.00 and v9.00 methods. You will find that there is only one more loop, in this example, do I know how to display multiple entries in other methods?