I am having difficulty setting the current date of my SQLite database in the% type attribute of my object.
The SQLite date comes in the format "yyyy-MM-dd". I'm trying to convert to the format accepted in type java.util.Date
and that allows me to use it in my Adapter but when running the application is returning me an error saying that the date is null. Actually when I debugged the App I saw that the date is not being set.
Follow the part of the code.
Date data = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
String dataTeste = cursor.getString(1);
try {
data = dateFormat.parse(dataTeste);
} catch (ParseException e) {
e.printStackTrace();
}
v.setDataVenda(data);
Note: In the variable java.util.Date
the value that is being filled is "2015-11-15".