アプリケーションは表示MapView
されていますが、指定された座標にズームインできません。私は何かが欠けています...どんな助けもいただければ幸いです
コードは以下のとおりです--
public Screen()
{
// Set the displayed title of the screen
setTitle("Roamiing Checker");
String currentNetwork = RadioInfo.getCurrentNetworkName();
add(new RichTextField("Current Operator:"+currentNetwork, Field.FOCUSABLE));
RichTextField roam_rtf = new RichTextField("",Field.FOCUSABLE);
if(Check_NON_CAN_Operator())
synchronized(Application.getEventLock())
{
roam_rtf.setText("Roaming");
}
else
synchronized(Application.getEventLock())
{
roam_rtf.setText("Not in roaming");
}
add(roam_rtf);
maps_rtf = new RichTextField("Waiting on current location.");
loc = new LocationThread();
loc.run();
Timer timer = new Timer();
timer.schedule(new LocationTimer(), 2*1000, 10*1000);
add(maps_rtf);
add(map_grid);
}
public class LocationTimer extends TimerTask
{
public LocationTimer()
{
}
public void run()
{
if(loc.getLatitude()==0 && loc.getLongitude()==0)
{
synchronized(App.getEventLock())
{
if(maps_rtf.getText().length() > 26)
{
if(maps_rtf.getText().length() > 32)
maps_rtf.setText("Waiting on current location.");
else
maps_rtf.setText(maps_rtf.getText() + ".");
}
else
maps_rtf.setText("Waiting on current location.");
}
}
else
{
if(counter==0)
synchronized(App.getEventLock())
{
maps_rtf.setText("");
BBMaps(loc.getLatitude(),loc.getLongitude(),loc.getAltitude());
counter++;
}
else
synchronized(App.getEventLock())
{
maps_rtf.setText("");
map_coord = new Coordinates(loc.getLatitude(),loc.getLongitude(),loc.getAltitude());
mf.moveTo(map_coord);
map_grid.set(mf,2,1);
map_grid.set(new RichTextField("Latitude:- "+ loc.getLatitude()),3,1);
map_grid.set(new RichTextField("Longitude:- "+ loc.getLongitude()),4,1);
map_grid.set(new RichTextField("Altitude:- "+ loc.getAltitude()),5,1);
//BBMaps(loc.getLatitude(),loc.getLongitude(),loc.getAltitude());
counter++;
}
}
}
}
public boolean Check_NON_CAN_Operator()
{
boolean NON_CANOperatorCheck = true;
final String CanadianOperators[] = {"Rogers Wireless" , "Telus" , "Bell"};
String CurrentNetworkName = "";
CurrentNetworkName = RadioInfo.getCurrentNetworkName();
if( CurrentNetworkName.equalsIgnoreCase(CanadianOperators[0])
|| CurrentNetworkName.equalsIgnoreCase(CanadianOperators[1])
||CurrentNetworkName.equalsIgnoreCase(CanadianOperators[2]) )
NON_CANOperatorCheck = false; //if Current Operator is CANADIAN then **FALSE**
else
NON_CANOperatorCheck = true; //if Current Operator is not CANADIAN then **TRUE** hence ROAMING
return NON_CANOperatorCheck;
}
public void BBMaps(double Lat,double Lng,float Alt)
{
mf.setPreferredSize(mf_width, mf_height); //480*100px
map_coord = new Coordinates(Lat,Lng, Alt);
mf.moveTo(map_coord); //Maps pointing on the current location(if found unless Greenland)
//Row 1
map_grid.add(new RichTextField("Roaming State:- " + String.valueOf(Check_NON_CAN_Operator()),Field.FOCUSABLE));
//Row 2
map_grid.add(mf); //Map Field added
//Row 3
map_grid.add(new RichTextField("Latitude:- " + Lat),Field.FOCUSABLE);
//Row 4
map_grid.add(new RichTextField("Longitude:- " + Lng),Field.FOCUSABLE);
//Row 5
map_grid.add(new RichTextField("Accuracy:- " + Alt),Field.FOCUSABLE);
}
私は厳密に OS 5.0 に取り組んでいます..6.0 だったら、新しい lbs.maps.* API でより簡単だったでしょう。