Ansif
Ansif

Reputation: 182

Android Map programming

Actually i am developing a Map browser app in Android. I have a .dat file contains map information with a File format like this,

struct point{
    int x,
        int y;
};

How can i read this .dat file using this format and copy the values into x and y?

Upvotes: 1

Views: 220

Answers (2)

Ali Behzadian Nejad
Ali Behzadian Nejad

Reputation: 9044

To draw a map, you need to extend View class and implement methods such as onMeasure(int, int) and onDraw(android.graphics.Canvas). Then inside onDraw you can draw your mapping elements directly with Canvas methods such as drawArc, drawCircle, drawLine, drawOval, drawPath, drawPoint, drawRect, drawText and so on. To get a clue look at this class (for example) in mapsforge.

Upvotes: 0

Ali Behzadian Nejad
Ali Behzadian Nejad

Reputation: 9044

If you mean offline map browser (Tiles stored locally in phones SD card) you have several options:

1- Use osmdroid map viewer (code.google.com/p/osmdroid). This library supports a range of formats for offline mode and also is able to connect to some online map tile providers(like openstreetmap). To create offline tiles for this library you can use Mobile Atlas Creator.

2- Use mapsforge. This library generates map tiles based on the data (renders map tiles dynamically).

Upvotes: 1

Related Questions