Is it possible to save part of google map and add it into my application and display it? beacuse I need only limited area and I dont want to use internet connection in application. Or maybe there is possibility to restrict area in online map?
Asked
Active
Viewed 62 times
1 Answers
0
If you want to save map once it loaded and then use that map in application then you have to save map in device sd card and then display where ever you want.
Below is code to save screen shot/image of google map -
public void SaveMapToSDCard() {
SnapshotReadyCallback callback = new SnapshotReadyCallback() {
Bitmap bitmap;
@Override
public void onSnapshotReady(Bitmap snapshot) {
bitmap = snapshot;
try {
FileOutputStream out = new FileOutputStream(FilePath+FileName);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (Exception e) {
e.printStackTrace();
}
}
};
myMap.snapshot(callback);
}
and call it to any where and later when you want to display map then get image from SDCard and display it.
Hope you get what i want to explain.All the best.

Ravi Bhandari
- 4,682
- 8
- 40
- 68
-
So there is no possibility to use part of google maps? because I need for example add pins and use coordinates, and its hard to achieve using png. I find this solution http://stackoverflow.com/questions/14977078/limit-scrolling-and-zooming-google-maps-android-api-v2 but its not beautiful solution so is it any other solution? – falsetto May 13 '15 at 08:35
-
What the problem with my solution.Draw map ,mark pins on it and create an image of it,use the image where you want. Any thing wrong?? – Ravi Bhandari May 13 '15 at 11:30
-
The problem is that I need to mark pins dynamically which can be problem without possibillity to use coords. – falsetto May 13 '15 at 12:06
-
In your initial question you ask save map and display it. My answer was for that question . You doesn't mention that you want to pin marker on that map.Please clear or your question so some one can post better answer. – Ravi Bhandari May 13 '15 at 12:09