Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6351125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:56:31+00:00 2026-05-24T21:56:31+00:00

I want to show some points/coordinates retrieved from an SQLite databse. The weird thing

  • 0

I want to show some points/coordinates retrieved from an SQLite databse. The weird thing that when I launch map activity I have the marker shown on a strange place, in the sea, near to Gabon and Nigeria: http://imageshack.us/f/402/gabond.png/

I tried to set manually the map to be centered on a given coordinates and always the same problem. One other thing, I have this logcat error when launching the activity:

08-21 13:19:59.326: ERROR/MapActivity(404): Couldn't get connection factory client

Code:

CoordBD CoordBd = new CoordBD(this);
        CoordBd.open();

        Coordo coordo = new Coordo(36.876673,10.325928);
        Coordo coordo2 = new Coordo(36.876982,10.326228);
        //CoordBd.open();
        CoordBd.insertCoordo(coordo);
        CoordBd.insertCoordo(coordo2);
        // CoordBd.close();

        maMap = (MapView)findViewById(R.id.myGmap);
        maMap.setBuiltInZoomControls(true);
        ItemizedOverlayPerso pinOverlay = new ItemizedOverlayPerso(getResources().getDrawable(R.drawable.marker));

        /*db = openOrCreateDatabase(
            "coord.bd"
            , SQLiteDatabase.CREATE_IF_NECESSARY
            , null
            );
        db.setVersion(1);
        db.setLocale(Locale.getDefault());
        db.setLockingEnabled(true);*/

        String[] result_columns = new String[] {COL_LATI, COL_LONGI};
        Cursor cur = db.query(true, TABLE_COORD, result_columns,
        null, null, null, null, null, null);
        cur.moveToFirst();
        while (cur.isAfterLast() == false) {
            int latitude = cur.getColumnIndex("latitude");
            int longitude = cur.getColumnIndex("longitude");
            point = new GeoPoint(microdegrees(latitude),microdegrees(longitude));
            pinOverlay.addPoint(point);
            cur.moveToNext();
        }
        cur.close();
        CoordBd.close();

        maMap.getOverlays().add(pinOverlay);
        monControler = maMap.getController();
        monControler.setZoom(12);
        monControler.setCenter(point);

        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);

What could be the source of the problem?
PS: I have the same problem when installing the app on the phone.
Thank you for your help.
EDIT: Logcat: (after modifying it with hooked answer):

08-22 01:55:35.381: ERROR/AndroidRuntime(253): Uncaught handler: thread main exiting due to uncaught exception
08-22 01:55:35.402: ERROR/AndroidRuntime(253): java.lang.RuntimeException: Unable to start activity ComponentInfo{carburant.android.com/carburant.android.com.Geo}: java.lang.IllegalStateException: get field slot from row 0 col -1 failed
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.os.Looper.loop(Looper.java:123)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread.main(ActivityThread.java:4363)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at java.lang.reflect.Method.invokeNative(Native Method)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at java.lang.reflect.Method.invoke(Method.java:521)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at dalvik.system.NativeStart.main(Native Method)
08-22 01:55:35.402: ERROR/AndroidRuntime(253): Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.database.CursorWindow.getDouble_native(Native Method)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.database.CursorWindow.getDouble(CursorWindow.java:399)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.database.AbstractWindowedCursor.getDouble(AbstractWindowedCursor.java:138)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at carburant.android.com.Geo.onCreate(Geo.java:92)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
08-22 01:55:35.402: ERROR/AndroidRuntime(253):     ... 11 more

EDIT: Added class creating the DB:

public class MaBaseSQLite extends SQLiteOpenHelper {
private static final String CREATE_BDD = "CREATE TABLE " + TABLE_COORD + " ("
    + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_LATI + " TEXT NOT NULL, "
    + COL_LONGI + " TEXT NOT NULL);";

    MaBaseSQLite(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //on créé la table à partir de la requête écrite dans la variable CREATE_BDD
        db.execSQL(CREATE_BDD);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:56:31+00:00Added an answer on May 24, 2026 at 9:56 pm

    Set a breakpoint in your while loop and you’ll probably notice that latitude and longitude are both 0, or 0 and 1. The problem is with the following two lines. You’re getting the column index, not actual values. You’ll also want to store your co-ordinates as doubles rather than integers:

    int latitude = cur.getColumnIndex("latitude");
    int longitude = cur.getColumnIndex("longitude");
    

    try setting it to:

    double latitude = cur.getDouble(cur.getColumnIndex("latitude"));
    double longitude = cur.getDouble(cur.getColumnIndex("longitude"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show some bold and some simple word within the same sentence.If
I want to show some dialog (absolute positioned div), and I want to show
I want to show some letters in Bibliography as capital. For example: @misc{libsvm, abstract
Say we have a standard WPF-application, and I want to show some UI-elements on
I want to dynamically hide/show some of the columns in a NSTableView, based on
I want to be able to show some account information in a ring chart.
I want to show the status of some files in a Java GUI. Each
I want to show a custom image with some data in it while clicking
I want to show HTML content inside Flash. Is there some way to do
There is some html text stored in the Database which I want to show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.