Issue
That's the formatdate method used :
private static java.util.Date formatDate(String webPublicationDate) {
SimpleDateFormat dateFormat;
dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
java.util.Date convertedDate = new java.util.Date();
try {
convertedDate = dateFormat.parse(webPublicationDate);
} catch (ParseException e) {
e.printStackTrace();
}
in the same class there's :
Date webPublicationDate = (Date) formatDate(date);
In the adapter class I'm using this to setText :
publishDate.setText((CharSequence) currentArticle.getPublishDate());
Which is giving me an error:
FATAL EXCEPTION: main java.lang.ClassCastException: java.sql.Date cannot be cast to java.lang.CharSequence
Solution
1) Are you sure, that currentArticle.getPublishDate()
returns the formatted String? If not, try to apply your #formatDate(currentArticle.getPublishDate())
2) You shouldn't misstake java.util.Date with java.sql.Date
Answered By - Anton Potapov