Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
LogCat and look at the stack trace associated with your "force close
error".

On Sat, May 7, 2011 at 7:53 AM, Ronald Imanuel <ronald.um...@gmail.com> wrote:
> i'm developing a simple GIS map with database. but all i get is force
> close error. can anyone help me correcting the code.  the main
> activity look like this :
>
> public class peta extends MapActivity
> {
>
>        private SQLiteDatabase db = null;
>        private String longitude = null;
>        private String latitude = null;
>        private String TABLE_NAME = "datauniv";
>
>    /** Called when the activity is first created. */
>    @Override
>    public void onCreate(Bundle savedInstanceState)
>    {
>        super.onCreate(savedInstanceState);
>
>        DataUniv datauniv = new DataUniv(this);
>        db = datauniv.getWritableDatabase();
>        datauniv.createTable(db);
>        datauniv.generateData(db);
>
>        setContentView(R.layout.main);
>
>        MapView mapView = (MapView) findViewById(R.id.mapView);
>        mapView.setBuiltInZoomControls(true);
>        double lat = -6.2532592788520005;
>        double lng = 106.853239291777;
>        GeoPoint point = new GeoPoint((int) (lat *1E6),(int) (lng *
> 1E6));
>        mapView.getController().animateTo(point);
>        mapView.getController().setZoom(15);
>
>        List<Overlay> mapOverlays = mapView.getOverlays();
>        Drawable drawable =
> this.getResources().getDrawable(R.drawable.marker);
>        MapsOverlay itemizedoverlay = new MapsOverlay(drawable, this);
>
>
>                Cursor cursor = db.query(TABLE_NAME, new String[] { latitude,
> longitude },
>                null, null, null, null, null);
>        cursor.moveToFirst();
>
>         //Log.i("Log", "Displaying markers through iteration");
>        while (cursor.isAfterLast() == false) {
>            lat = Double.parseDouble(cursor.getString(2));
>            lng = Double.parseDouble(cursor.getString(3));
>       //       Log.i("Points", lat + "     " + lng);
>            point = new GeoPoint((int) (lat * 1E6), (int) (lng *
> 1E6));
>            OverlayItem overlayitem = new OverlayItem(point, "", "");
>            itemizedoverlay.addOverlay(overlayitem);
>            mapOverlays.add(itemizedoverlay);
>            cursor.moveToNext();
>        }
>
>
>    }
>
> The complete project is in here :
> http://www.mediafire.com/?94t1f9bm6ddmwt0
>
> Thx before :)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to