Skip to content
Advertisement

How to prevent saving empty data in SQLite database

I dont want to save empty data in my Note App. I have tried Everything but when I leave Edittexts empty it still saves data into my data base. what should I do?

this is my insertNote method

JavaScript

and this is the method that saves my notes in my AddNoteActivity

JavaScript

i have also tried this but this is but this doesn’t work either

JavaScript

appreciate any help…

Advertisement

Answer

First check edittext are blank or not. Use trim() as well as @Umesh suggested.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement