I am currently developing a tracking system to plot out the user's movement trajectory inside a room or whaterever.
Now i have managed to import my map into the app and the map is free to be zoomed and moved. The next step is to place a marker to indicate the user location on the map and move the mark around OVER the map. (like floating on the map)
I read it somewhere and think this may be done with MyLocationOverlay, but most of the examples online are all to apply it onto the google map. However, in my case, my map is not google map, it is my OWN map. (The map can be the map of my room or even a map that I draw myself!)
I have done the tracking algorithm, i.e. I know where to place my marker image.
So the only question remains is how to present the marker image on top of the map image.
In details, I have a self-defined view, MapView, as follows:
package com.example.drsystem;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
public class MapView extends View {
private static final int INVALID_POINTER_ID = -1;
private Drawable mImage;
private float mPosX;
private float mPosY;
private float mLastTouchX;
private float mLastTouchY;
private int mActivePointerId = INVALID_POINTER_ID;
private ScaleGestureDetector mScaleDetector;
private float mScaleFactor = 1.f;
public MapView(Context context) {
this(context, null, 0);
mImage = getResources().getDrawable(R.drawable.lv12n);
mImage.setBounds(0, 0, mImage.getIntrinsicWidth(), mImage.getIntrinsicHeight());
}
// called when XML tries to inflate this View
public MapView(Context conte