MapView,DataFramework(MapView, DataFramework)

编程入门 行业动态 更新时间:2024-10-19 10:19:20
MapView,DataFramework(MapView, DataFramework)

我是一个新手android开发者,现在我正在使用Mapview。 我想在地图中显示基于他的纬度和经度的不同种类的叠加。

我用sqlite创建了一个数据库,保存在文件夹资产上。 这是我的tables.xml(对不起,但字段是西班牙语)

<database name="loteria.db" version="1"> <table name="puestos" to-string="%direccion%"> <field name="direccion" type="text" obligatory="true"/> <field name="latitud" type="double" obligatory="false"/> <field name="longitud" type="double" obligatory="false"/> </table> </database>

太简单了。 这一刻我不需要更多。 在thar之后我创建了一个名为MapaActivity的Activity,我绘制了mapView。 这里我有2个问题,第一个,我的mapView必须是TapControlledMapView,因为我想使用方法onsingleTapListener,但我不能,它导致FC总是,我不知道为什么!

第二个问题是当我想从数据库中提取实体列表(列表

List<Entity> puestos = Lists.newArrayList(); DataFramework db = null; try { db = DataFramework.getInstance(); db.open(this, getPackageName()); puestos = db.getEntityList("puestos", "latitud < " + maxLatitud + " and latitud > " + minLatitud + " and longitud < " + maxLongitud + " and longitud > " + minLongitud); } catch (Exception e) { e.printStackTrace(); } finally { db.close(); }

什么都没发生,puestos总是空的。

有任何想法吗???

谢谢!

i am a newbie android developper and now i'm working with Mapview. I want to show in a map differents kinds of Overlays base on his latitude and longitude.

I have created a data base with sqlite, saved on the folder assets. This is my tables.xml (sorry but the fields are in spanish)

<database name="loteria.db" version="1"> <table name="puestos" to-string="%direccion%"> <field name="direccion" type="text" obligatory="true"/> <field name="latitud" type="double" obligatory="false"/> <field name="longitud" type="double" obligatory="false"/> </table> </database>

Is too simple. I dont need more for this moment. After thar i've created an Activity called MapaActivity where i draw my mapView. Here i have 2 problems, first one, my mapView has to be a TapControlledMapView because i want to use the method onsingleTapListener, but i cant, its caused FC always and i dont why!

The second trouble is when i want to extract from the database a list of Entitys (List

List<Entity> puestos = Lists.newArrayList(); DataFramework db = null; try { db = DataFramework.getInstance(); db.open(this, getPackageName()); puestos = db.getEntityList("puestos", "latitud < " + maxLatitud + " and latitud > " + minLatitud + " and longitud < " + maxLongitud + " and longitud > " + minLongitud); } catch (Exception e) { e.printStackTrace(); } finally { db.close(); }

Nothing happens, puestos is always empty.

Any ideas???

Thanks!

最满意答案

你怎么不只是使用SQLiteOpenHelper? 查看本教程: http : //www.vogella.com/articles/AndroidSQLite/article.html

我怀疑你会比用xml构建表更好运。

How come you're not just using the SQLiteOpenHelper? Check out this tutorial: http://www.vogella.com/articles/AndroidSQLite/article.html

I suspect you will have better luck with it than building your tables with xml.

更多推荐

本文发布于:2023-07-04 17:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026990.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MapView   DataFramework

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!