Arehexes
Well-Known Member
Can't figure this out but when ever I try to call the ok action event for my date list dailog it crashes and it seems to want to crash on the day.isCheck() (I checked and commented everything but that one line.)
This is the section that gives me trouble in my code and it only crashes when I run ok.setOnClickListener for the checkboxes. Anyone know what i coul dbe doing wrong with this?
Code:
dates.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
final Dialog dateDialog=new Dialog(CollegeTracker.this);
dateDialog.setContentView(R.layout.datelist);
dateDialog.setTitle("Set Days");
dateDialog.setCancelable(true);
final CheckBox sunday=(CheckBox) findViewById(R.id.datelistSundayCB);
final CheckBox monday=(CheckBox) findViewById(R.id.datelistMondayCB);
final CheckBox tuesday=(CheckBox) findViewById(R.id.datelistTuesdayCB);
final CheckBox wednesday=(CheckBox) findViewById(R.id.datelistWednesdayCB);
final CheckBox thursday=(CheckBox) findViewById(R.id.datelistThursdayCB);
final CheckBox friday=(CheckBox) findViewById(R.id.datelistFridayCB);
final CheckBox saturday=(CheckBox) findViewById(R.id.datelistSaturdayCB);
//final ArrayList<String> tempDates=new ArrayList<String>();
Button ok=(Button) dateDialog.findViewById(R.id.datelistOkButton);
ok.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0) {
if(sunday.isChecked()) holder.days.add("Sunday");
/*if(monday.isChecked()) tempDates.add("Monday");
if(tuesday.isChecked()) tempDates.add("Tuesday");
if(wednesday.isChecked()) tempDates.add("Wednesday");
if(thursday.isChecked()) tempDates.add("Thursday");
if(friday.isChecked()) tempDates.add("Friday");
if(saturday.isChecked()) tempDates.add("Saturday");*/
dateDialog.dismiss();
}
});
Button cancel=(Button) dateDialog.findViewById(R.id.datelistCancelButton);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
dateDialog.dismiss();
}
});
dateDialog.show();
}
});
This is the section that gives me trouble in my code and it only crashes when I run ok.setOnClickListener for the checkboxes. Anyone know what i coul dbe doing wrong with this?