1
I’m trying to create an app that records data and displays it in a Listview, and then gradually sophisticate the app, but when it comes to saving the data in the database, it doesn’t save. In Debug it runs everything right, in the last line, as it is in the image below, out of nowhere it returns "false". The strange thing is that he seems to be searching for the data. And the id always returns "0" I don’t understand why.
Then I also discovered that my Arraylist doesn’t seem to work either. Every time I go to the part of my app to show recorded data (The Fragment that corresponds to Listview) the app closes itself. Using Debug I discovered two details, one in Datasource and the other in Fragment where I program to show the data that is saved. Normally I would think that since there is no recorded data, then it will not work. But I think the app should not close alone, at most it should only show a blank screen.
The weirdest thing is that I’ve worked with another application using virtually the same code templates, so I don’t understand why so many problems.
Show the code of the Insert.
– Augusto Vasques
public Boolean Insert(String table, Contentvalues data) { Boolean success = true; Try { success = db.Insert(table, null, data) > 0; } catch (Exception e) { success = false; } success; }
– David