0

インターネットに接続しているときは正常に機能する完全な地図を作成しましたが、インターネットに接続していなくても地図を使用したいのですが、オンライン地図で最もよく機能する地理的位置を表示する必要があります。今私の質問は、新しい実装を使用してオフライン マップ用の新しいプロジェクトを再度作成する必要があるか、それとも自分のマップをオフラインで使用して変更を加えることができるかということです。私が次にしなければならないことの両方の状況で私を導いてください。

       map=(MapView) findViewById(R.id.mvmain);
    map.setBuiltInZoomControls(true);
    touchy t=new touchy();
    overlayList=map.getOverlays();
    overlayList.add(t);
    compass= new MyLocationOverlay(Main.this, map);
    overlayList.add(compass);
    controller= map.getController();

    mapSearchBox = (EditText) findViewById(R.id.map);

    mapSearchBox.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
             if (actionId == EditorInfo.IME_ACTION_SEARCH ||
                    actionId == EditorInfo.IME_ACTION_DONE ||
                    actionId == EditorInfo.IME_ACTION_GO ||
                    event.getAction() == KeyEvent.ACTION_DOWN &&
                    event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {

                // hide virtual keyboard
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(mapSearchBox.getWindowToken(), 0);

                new SearchClicked(mapSearchBox.getText().toString()).execute();
                mapSearchBox.setText("", TextView.BufferType.EDITABLE);
                return true;
            }
            return false;
        }
    });



    d =getResources().getDrawable(R.drawable.aa);       
    controller.setZoom(6);

    //Placing pinpoint at location
    lm=(LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Criteria crit=new Criteria();
    towers=lm.getBestProvider(crit, false);
    Location location=lm.getLastKnownLocation(towers);
    if(location !=null)
    {
        lat=(int) (location.getLatitude() *1E6);
        longi=(int) (location.getLongitude() *1E6);         
        GeoPoint ourLocation= new GeoPoint(lat,longi);
        OverlayItem overlayItem= new OverlayItem(ourLocation,"","");
        CustomPinpoint custom=new CustomPinpoint(d,Main.this);
        custom.insertPinPoint(overlayItem);
        overlayList.add(custom);



    }
    else
    {
        Toast.makeText(Main.this,"Couldn't get provider",                     Toast.LENGTH_SHORT).show();

    }

        }
4

1 に答える 1

2

インターネットがないとGoogleマップを表示できません。オフラインタイトルを表示できるOSMDroidを試すことができます。

于 2013-01-27T16:01:39.567 に答える