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

  • SEARCH
  • Home
  • 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 8951367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:38:49+00:00 2026-06-15T13:38:49+00:00

in logcat i have this error: 12-05 19:20:26.696: E/SQLiteDatabase(1415): Error inserting lon=5.25 lat=7.52 name=null

  • 0

in logcat i have this error:

12-05 19:20:26.696: E/SQLiteDatabase(1415): Error inserting lon=5.25 lat=7.52 name=null
12-05 19:20:26.696: E/SQLiteDatabase(1415): android.database.sqlite.SQLiteException: no such table: position (code 1): , while compiling: INSERT INTO position(lon,lat,name) VALUES (?,?,?)

I try to insert 3 value: name,lat,lon in the table named: position. In the code i don’t have any error and the app don’t crash. I have attached the event of the insert of the value to a button with a onClickListener (when the user press the button,insert the value).

The code of the database creation:

public class listagpsdb {

SQLiteDatabase mDb;
DbHelper mDbHelper;
Context mContext;
private static final String DB_NAME="listagps";
private static final int DB_VERSION=1;

public listagpsdb(Context ctx){
        mContext=ctx;
        mDbHelper=new DbHelper(ctx, DB_NAME, null, DB_VERSION);
}

public void open(){  //il database su cui agiamo è leggibile/scrivibile
        mDb=mDbHelper.getWritableDatabase();

}

public void close(){ 
        mDb.close();
}




public void insertPosition(String name,double lat, double lon){ 
        ContentValues cv=new ContentValues();
        cv.put(PositionsMetaData.POSITIONS_NAME_KEY, name);
        cv.put(PositionsMetaData.POSITIONS_LATITUDE_KEY, lat);
        cv.put(PositionsMetaData.POSITIONS_LONGITUDE_KEY, lon);
        mDb.insert(PositionsMetaData.POSITIONS_TABLE, null, cv);
}

public Cursor fetchProducts(){ 
        return mDb.query(PositionsMetaData.POSITIONS_TABLE, null,null,null,null,null,null);               
}

static class PositionsMetaData {  
        static final String POSITIONS_TABLE = "position";
        static final String ID = "_id";
        static final String POSITIONS_NAME_KEY = "name";
        static final String POSITIONS_LATITUDE_KEY = "lat";
        static final String POSITIONS_LONGITUDE_KEY = "lon";
}

private static final String POSITIONS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS"  
                + PositionsMetaData.POSITIONS_TABLE + " (" 
                + PositionsMetaData.ID+ " integer primary key autoincrement, "
                + PositionsMetaData.POSITIONS_NAME_KEY + " text, "
                + PositionsMetaData.POSITIONS_LATITUDE_KEY + " double not null);"
                + PositionsMetaData.POSITIONS_LONGITUDE_KEY + "double not null);";

private class DbHelper extends SQLiteOpenHelper { 

        public DbHelper(Context context, String name, CursorFactory factory,int version) {
                super(context, name, factory, version);
        }

        @Override
        public void onCreate(SQLiteDatabase _db) { 
                _db.execSQL(POSITIONS_TABLE_CREATE);
        }

        @Override
        public void onUpgrade(SQLiteDatabase _db, int oldVersion, int newVersion) {


        }

}

}

In the code you see i want to create the table only when the database are created.

This the code of the activity class:

@Override
    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_navi);



                Button SalvaLocation = (Button) findViewById(R.id.SalvaLocation);
                final listagpsdb db = new listagpsdb(getApplicationContext());
                SalvaLocation.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View view) {



                    db.open(); 

                    String name = null;
                    Double lat = 7.52;
                    Double lon = 5.25;
                    db.insertPosition(name, lat, lon);

                    db.close();

                    }
                });

Now i don’t understand why the database/table are not created. Anyone have an idea?
There’s a trick to see in the AVD memory if the database are created or not?

Thank’s to all want to help me!

  • 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-06-15T13:38:51+00:00Added an answer on June 15, 2026 at 1:38 pm

    update your code at PositionsMetaData.POSITIONS_LATITUDE_KEY..

    private static final String POSITIONS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS"  
                    + PositionsMetaData.POSITIONS_TABLE + " (" 
                    + PositionsMetaData.ID+ " integer primary key autoincrement, "
                    + PositionsMetaData.POSITIONS_NAME_KEY + " text, "
                    + PositionsMetaData.POSITIONS_LATITUDE_KEY + " double not null,"
                    + PositionsMetaData.POSITIONS_LONGITUDE_KEY + " double not null);";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got this logcat error more then one time. This time I started
I have closed the database in my adapter class, so whay is this error
I am getting this error while executing my android app. I have created the
I am getting this LogCat: 06-22 15:30:53.731: E/AndroidRuntime(2389): java.lang.NumberFormatException: Invalid float: null 06-22 15:30:53.731:
i got this error in the logcat 06-21 11:58:27.275: E/AndroidRuntime(404): java.lang.RuntimeException: Unable to start
I get this error message in LogCat: 06-25 15:17:34.495: E/AndroidRuntime(5891): java.lang.RuntimeException: Unable to start
I'm having problems with SQLite in Android. Eclipse does not report any error in
i get this error : unfortunetly your app must stop and the Logcat is,please
I'm new to Android development and I have this strange problem.. Depending on the
I have this type of error can you help me how can i solve

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.