[Solved] NullPointerException inserting into an SQLite database? [closed]


You have not initialized your variable mStockageDao.

Do this in onCreate() method:

StockageDAO mStockageDao = new mStockageDao(AddStockageFragment.this);

And before the code:

Stockage createdStockage = mStockageDao.createStockage(stockqte,datestock,seulstock,LocalStock,1);

call this

mStockageDao.open();

NOTE:
When you are done querying your database, call mStockageDao.close();

solved NullPointerException inserting into an SQLite database? [closed]