What I want to do... Access the blackberry maps and add in an Image at users specified location if the User does not
specify the Location then find the current location of the customer and add the image to those coordinates...
if you take a look at the following link I would like the mapview to be exactly the same... How to show our own icon in BlackBerry Map?
For now I am not worried getting the coordinates of the address the user supplies and adding in the image to those coordinates, at the moment if i can get the "find my location"Function working correctly with adding the image at the correct coordinates il be very happy.
What my code is currently doing is adding two maps... the one map looks like the one in the following link: How to show our own icon in BlackBerry Map?
But Has no Image, then when You click back another map appears that is zoomed out as far as one to be viewing countries with the Icon popping up.
My Code (MainScreen)
lat = qualifiedCoordinates.getLatitude();
lng = qualifiedCoordinates.getLongitude();
latString = Double.toString(lat);
lngstring = Double.toString(lng);
String Test2=".";
String Test3="";
FinalSringLatetude =replace(latString,Test2,Test3);
FinalSringLongdetude =replace(lngstring,Test2,Test3);
intLat = Integer.valueOf(FinalSringLatetude).intValue();
iintLng = Integer.valueOf(FinalSringLongdetude).intValue();
mCoordinates = new Coordinates(doublelat, doublelon, 0);
mMapField = new CustomMapField();
mMapField.mIcon = Bitmap.getBitmapResource("coin_silver.png");
mMapField.moveTo(mCoordinates);
MapView mapView = new MapView();
mapView.setLatitude(intLat);
mapView.setLongitude(iintLng);
mapView.setZoom(10);
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(mapView));
add(mMapField);
(custom MapField Class)
Bitmap mIcon;
XYRect mDest;
public void moveTo(Coordinates coordinates) {
super.moveTo(coordinates);
mDest = null;
}
protected void paint(Graphics graphics) {
super.paint(graphics);
if (null != mIcon) {
if (null == mDest) {
XYPoint fieldOut = new XYPoint();
convertWorldToField(getCoordinates(), fieldOut);
int imgW = mIcon.getWidth();
int imgH = mIcon.getHeight();
mDest = new XYRect(fieldOut.x - imgW / 2,
fieldOut.y - imgH, imgW, imgH);
}
graphics.drawBitmap(mDest, mIcon, 0, 0);
}
}
thank you guys!!
The following code will do the Zoom functionality.
mMapField.setZoom(3);