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 7877039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:16:05+00:00 2026-06-03T03:16:05+00:00

i have some data to write in data base (three strings); i have a

  • 0

i have some data to write in data base (three strings);
i have a private class DBHelper extends SQLiteOpenHelper
and i have dataBase = dbHelper.getWritableDatabase();
When i do dataBase.insert() i have a nullPointerException.

i checked my data in debuger for write and they don’t equal to null;

DBHelper:

private class DBHelper extends SQLiteOpenHelper { //for write and read data from DB

static final String GROUPPS = "groupps";
static final String IMPORTANCE = "importance";
static final String NAME_OF_TABLE = "Person";
static final String PERSON_KEY = "perskey";

    private static final String MY_QUERY = "CREATE TABLE " + NAME_OF_TABLE + " ( " +
            PERSON_KEY + " TEXT, " +
            GROUPPPS + " TEXT, " +
            IMPORTANCE + " TEXT);";

    public DBHelper(Context context) {
        // constructor of superclass
        super(context, "MyDBB", null, 2);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.d("", "--- onCreate database ---");
        db.execSQL(MY_QUERY);
    }

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

    }
}

my method for write data on the dataBase:

 public void writeDataToDB(ArrayList<Person> arrayList) {

    contentValues = new ContentValues();
    dbHelper = new DBHelper(activity.getApplicationContext());
    dataBase = dbHelper.getWritableDatabase();


    for (int i = 0; i < arrayList.size(); i++) {

        contentValues.put(PERSON_KEY, arrayList.get(i).getKey());
        contentValues.put(GROUPPPS, arrayList.get(i).getGroup());
        contentValues.put(IMPORTANCE, String.valueOf(arrayList.get(i).isImportant()));

        Log.e("writeDataToDB", "Start inserting " + contentValues.toString());
        long rowID = dataBase.insert(NAME_OF_TABLE, null, contentValues);
        Log.e("writeDataToDB - ", "Value inserted, rowID = " + rowID);
        contentValues.clear();
    }

}

And in my method i have exception at line :
long rowID = dataBase.insert(NAME_OF_TABLE, null, contentValues);
and rowID = -1 it means – somthing wrong;

and my LogCat:

Error inserting groupp=Withoutgroup importance=false perskey=0r2-2B43414D272B4D16
    android.database.sqlite.SQLiteException: table Persons has no column named groupp: , while compiling: INSERT INTO Persons(groupp,importance,perskey) VALUES (?,?,?)
  • 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-03T03:16:05+00:00Added an answer on June 3, 2026 at 3:16 am

    Group is a keyword so if your table has this as column name then that may be problem.
    see

    group=Without group
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write some data in several database. I choose sqlapi.com I have
I need to read and write some data through named pipes. I have tested
I have some binary data produced as base-256 bytestrings in Python (2.x). I need
I have created an application that writes some data to the root folder of
I have some data with messed-up accented characters. For example in the data we
I have some data grouped in a table by a certain criteria, and for
I have some data of the form Key ID Link 1 MASTER 123 2
I have some data. I want to go through that data and change cells
I have some data that I want to store somewhere in my Rails app
I have some data stored as ArrayList . And when I want to backup

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.