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 7007681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:38:20+00:00 2026-05-27T21:38:20+00:00

how can i launch mpas than contains precatch feature API instead of mapview because

  • 0

how can i launch mpas than contains precatch feature API instead of mapview because i want to use the offline feature
this is my class any information could be help

public class mapactivity extends MapActivity{

MapView mapView; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.mapsxml); 
MapView mapView = (MapView) findViewById(R.id.mapView); 



Bundle b = getIntent().getExtras(); 

String Mylat = b.getString("Mylat");
String Mylon = b.getString("Mylon");
String Rlat = b.getString("Rlat");
String Rlon = b.getString("Rlon");


double src_lat =Double.valueOf(Mylat);  
double src_long =Double.valueOf(Mylon);
double dest_lat = Double.valueOf(Rlat);
double dest_long = Double.valueOf(Rlon);
GeoPoint srcGeoPoint = new GeoPoint((int) (src_lat * 1E6), 
(int) (src_long * 1E6)); 
GeoPoint destGeoPoint = new GeoPoint((int) (dest_lat * 1E6), 
(int) (dest_long * 1E6)); 

DrawPath(srcGeoPoint, destGeoPoint, Color.GREEN, mapView); 

mapView.getController().animateTo(srcGeoPoint); 
mapView.getController().setZoom(15); 
Toast.makeText(getBaseContext(), "Latitude: " +   Rlat+ "Longitude: " +Rlon, Toast.LENGTH_SHORT).show();
} 


@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

private void DrawPath(GeoPoint src,GeoPoint dest, int color, MapView mMapView01) 
{ 
// connect to map web service 
StringBuilder urlString = new StringBuilder(); 
urlString.append("http://maps.google.com/maps?"+"&saddr="+ Double.toString((double)src.getLatitudeE6()/1.0E6 )+","+Double.toString((double)src.getLongitudeE6()/1.0E6 )+"&daddr="+Double.toString((double)dest.getLatitudeE6()/1.0E6 )+","+Double.toString((double)dest.getLongitudeE6()/1.0E6 )+"&ie=UTF8&0&om=0&output=kml");

/*urlString.append("&saddr=");//from 
urlString.append( Double.toString((double)src.getLatitudeE6()/1.0E6 )); 
urlString.append(","); 
urlString.append( Double.toString((double)src.getLongitudeE6()/1.0E6 )); 
urlString.append("&daddr=");//to 
urlString.append( Double.toString((double)dest.getLatitudeE6()/1.0E6 )); 
urlString.append(","); 
urlString.append( Double.toString((double)dest.getLongitudeE6()/1.0E6 )); 
urlString.append("&ie=UTF8&0&om=0&output=kml"); */
Log.d("xxx","URL="+urlString.toString()); 
// get the kml (XML) doc. And parse it to get the coordinates(direction route). 
Document doc = null; 
HttpURLConnection urlConnection= null; 
URL url = null; 
try 
{ 
url = new URL(urlString.toString()); 
urlConnection=(HttpURLConnection)url.openConnection(); 
urlConnection.setRequestMethod("GET"); 
urlConnection.setDoOutput(true); 
urlConnection.setDoInput(true); 
urlConnection.connect(); 

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
DocumentBuilder db = dbf.newDocumentBuilder(); 
doc = db.parse(urlConnection.getInputStream()); 

if(doc.getElementsByTagName("GeometryCollection").getLength()>0) 
{ 
//String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getNodeName(); 
String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getFirstChild().getNodeValue() ; 
Log.d("xxx","path="+ path); 
String [] pairs = path.split(" "); 
String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude lngLat[1]=latitude lngLat[2]=height 
// src 
GeoPoint startGP = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); 
mMapView01.getOverlays().add(new MyOverLay(startGP,startGP,1)); 
GeoPoint gp1; 
GeoPoint gp2 = startGP; 
for(int i=1;i<pairs.length;i++) // the last one would be crash 
{ 
lngLat = pairs[i].split(","); 
gp1 = gp2; 
// watch out! For GeoPoint, first:latitude, second:longitude 
gp2 = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); 
mMapView01.getOverlays().add(new MyOverLay(gp1,gp2,2,color)); 
Log.d("xxx","pair:" + pairs[i]); 
} 
mMapView01.getOverlays().add(new MyOverLay(dest,dest, 3)); // use the default color 
} 
} 
catch (MalformedURLException e) 
{ 
e.printStackTrace(); 
} 
catch (IOException e) 
{ 
e.printStackTrace(); 
} 
catch (ParserConfigurationException e) 
{ 
e.printStackTrace(); 
} 
catch (SAXException e) 
{ 
e.printStackTrace(); 
} 
}

/*Double src_lat =Double.valueOf(Mylat); //31.964396; // the testing source 
Double src_long =Double.valueOf(Mylon);//35.887871; 
Double dest_lat = Double.valueOf(Rlat);//32.55289; // the testing destination 
Double dest_long = Double.valueOf(Rlon);//35.857658; 
double src_lat =Double.valueOf(Mylat.trim()).doubleValue(); //31.964396; // the testing source 
double src_long =Double.valueOf(Mylon.trim()).doubleValue();//35.887871; 
double dest_lat = Double.valueOf(Rlat.trim()).doubleValue();//32.55289; // the testing destination 
double dest_long = Double.valueOf(Rlon.trim()).doubleValue();//35.857658;


double src_lat =Double.valueOf(ml.trim()).doubleValue(); // the testing source 
double src_long = Double.valueOf(mlon.trim()).doubleValue(); 
double dest_lat = Double.valueOf(dl.trim()).doubleValue();//32.55289; // the testing destination 
double dest_long = Double.valueOf(dlon.trim()).doubleValue();//35.857658;*/

}
  • 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-27T21:38:20+00:00Added an answer on May 27, 2026 at 9:38 pm

    The Google Maps library doesn’t support caching of tiles. I think it’s even against the TOS.

    You try using the OSM library for Android. You can use offline maps with this library, there is a tool for this called OsmAndMapCreator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I launch an event that has accessors like this : public event
I just installed Cygwin and can launch a bash shell from windows, do ls
I have a c program which I can launch at command prompt. Is it
I have an application where I can launch a modal dialog box over a
Does anyone have an example AUTORUN.INF which can launch an MSI installer automatically when
How can I launch an application using C#? Requirements: Must work on Windows XP and
How can I launch the Safari browser or the user's default browser pointing it
How can I launch an application with administrator rights after I have completed an
In Silverlight how can I launch / navigate to another page?
In VB.net, how can you programmatically launch a .exe file? Is there a way

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.