im developing a time management app. For my assignment module part, i allow the user choose the due date they want, and it will compare with the phone time and it will highlight the assignment tittle become red color before one day the assignment due date.
UPDATED PROBLEM im successful get both date and compare bt get error remainder of day. below is my source code, sry for my coding flow, i know its very mess.
// get the current date
final Calendar c = Calendar.getInstance();
Date today = Calendar.getInstance().getTime();
//show current date
TextView current = (TextView)findViewById(R.id.textView);
SimpleDateFormat df = new SimpleDateFormat("ddMyyyy");
String formattedDate = df.format(c.getTime());
current.setText(formattedDate);
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
//get the remainder date
int days = Days.daysBetween(new DateTime(formattedDate), new DateTime(today)).getDays();
//show the remainder date
String tempdays = String.valueOf(days);
TextView txtdate3 = (TextView) findViewById(R.id.textView3);
txtdate3.setText(tempdays);
//show the user input date from datepicker
label=(TextView)findViewById(R.id.textView2);
// display the current date
updatedate();
btn=(Button)findViewById(R.id.button);
btn.setOnClickListener(this);
FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{my.com.chyi.assigment/my.com.chyi.assigment.MainActivity}: java.lang.IllegalArgumentException: Invalid format: "06/22/2010" is malformed at "/22/2010"java.lang.IllegalArgumentException: Invalid format: "20/20/2015" is malformed at "/20/2015" java.lang.IllegalArgumentException: Invalid format: "21/20/2015" is malformed at "/20/2015" java.lang.ArithmeticException: Value cannot fit in an int: -7743140921java.lang.ArithmeticException: Value cannot fit in an int: -9204110890java.lang.ArithmeticException: Value cannot fit in an int: -7396160515java.lang.ArithmeticException: Value cannot fit in an int: -6355219424java.lang.ArithmeticException: Value cannot fit in an int: -6388091249