I have found alternatives.
For absolute date and time, try this (not sure if this is the best way but it works and is fast):
Using java Syntax Highlighting
- long created = c.getLong(dateColumn);
- Date nDate = new Date(created);
- Calendar cal = Calendar.getInstance();
- cal.setTime(nDate);
- int iMonth = cal.get(Calendar.MONTH) + 1;
- int iDay = cal.get(Calendar.DAY_OF_MONTH);
- int iDayName = cal.get(Calendar.DAY_OF_WEEK);
- int iHour = cal.get(Calendar.HOUR);
- int iMin = cal.get(Calendar.MINUTE);
- int iAmPm = cal.get(Calendar.AM_PM);
- String month = Integer.toString(iMonth);
- if(iMonth == 1){
- month = "January";
- }
- if(iMonth == 2){
- month = "February";
- }
- if(iMonth == 3){
- month = "March";
- }
- if(iMonth == 4){
- month = "April";
- }
- if(iMonth == 5){
- month = "May";
- }
- if(iMonth == 6){
- month = "June";
- }
- if(iMonth == 7){
- month = "July";
- }
- if(iMonth == <img src="http://www.anddev.org/images/smilies/cool.png" alt="8)" title="Cool" />{
- month = "August";
- }
- if(iMonth == 9){
- month = "September";
- }
- if(iMonth == 10){
- month = "October";
- }
- if(iMonth == 11){
- month = "November";
- }
- if(iMonth == 12){
- month = "December";
- }
- String dayName = Integer.toString(iDayName);
- if(iDayName == 1){
- dayName = "Sunday";
- }
- if(iDayName == 2){
- dayName = "Monday";
- }
- if(iDayName == 3){
- dayName = "Tuesday";
- }
- if(iDayName == 4){
- dayName = "Wednesday";
- }
- if(iDayName == 5){
- dayName = "Thursday";
- }
- if(iDayName == 6){
- dayName = "Friday";
- }
- if(iDayName == 7){
- dayName = "Saturday";
- }
- String day = Integer.toString(iDay);
- if(iDay < 10){
- day = "0" + day;
- }
- String hour = Integer.toString(iHour);
- if(iHour == 0){
- hour = "12";
- }
- String min = Integer.toString(iMin);
- if(iMin < 10){
- min = "0" + min;
- }
- String amPm = Integer.toString(iAmPm);
- if(iAmPm == 0){
- amPm = "AM";
- } else {
- amPm = "PM";
- }
- String myDate = dayName + ", " + month + " " + day + "," + " " + cal.get(Calendar.YEAR);
- String myTime = hour + ":" + min + " " + amPm;
- callList.add(new IconifiedText(callerName, callerPhoneNumber, myDate, myTime, currentIcon));
Parsed in 0.043 seconds, using GeSHi 1.0.8.4
This is will ouput the date like so: Saturday, March 28, 2009
and the time: 11:30 AM
IMPORTANT - I have modified the IconifiedTextListAdapter.java, IconifiedText.java, and IconifiedTextView.java to accept the extra "myDate" and "myTime" views. This must be done first, if you wish to implement my date and time fix (HINT - just 'duplicate' the existing TextViews).
If anyone needs help on making this work, feel free to ask me how to do it. I promise to answer, whether or not I know how to help.
I have a solution for relative dates and times, however it requires a ViewBinder and SimpleCursorAdapter to be used, and I have yet to figure out how to incorporate with the IconifiedTextListAdapter.
Hope this helps someone.
- iPaul Pro


