【问题标题】:How can i Submit search Results To SQLite table in Android Maps我如何将搜索结果提交到 Android 地图中的 SQLite 表
【发布时间】:2012-05-10 03:38:14
【问题描述】:

我想将搜索地点位置存储到 Android 中的 Sqlite 数据库中,然后我在 Android 的 Listview 中填充位置搜索,我正在使用 http://maps.google.com/maps?从此我通过在 Mpas 中搜索获得位置我如何从该地址获取 Lat 和 Lang 并提交到数据库。

【问题讨论】:

    标签: android sqlite maps store


    【解决方案1】:

    编写代码以在 onLocationChanged(Location location) 内的 DB 中插入位置,每次获得新位置时,它将按照您的需要存储在数据库中。

    【讨论】:

    • 请提供一些示例我正在搜索地图中的位置 Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("maps.google.com/maps?")); startActivity(intent) ;
    • 所以在LocationChagedListener的onLocationChanged(Location location)方法里面写代码
    • 按照链接中给出的示例,您将实现您的目标。
    • public void onLocationChanged(Location location) { // TODO 自动生成的方法存根 double lat = location.getLatitude();双 lon = location.getLongitude(); TextView txtLat = (TextView)findViewById(R.id.txt_lat); txtLat.setText(String.format("%.6f", lat)); TextView txtLon = (TextView)findViewById(R.id.txt_lon); txtLon.setText(String.format("%.6f", lon)); MapView 地图 = (MapView)findViewById(R.id.mapview1);
    • map.getController().animateTo(new GeoPoint((int)(lat*1E6),//1000000), (int)(lon*1E6))); }//onLocationChanged
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多