I am trying to set alarm and notify user at the user's specified time. But I get NullPointerException at boundService.setAlarm(cal). I checked this link with a similar question but the solutions did not help me. Any help will be much appreciated.
Thanks a lot in advance!
DateAndTimePickerActivity
public class DateAndTimePickerActivity extends FragmentActivity implements
    OnClickListener {
    public Calendar cal;
     private ScheduleClient scheduleClient;
  @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    scheduleClient = new ScheduleClient(this);
    scheduleClient.doBindService();
   }
    @Override
  private DatePickerDialog.OnDateSetListener mDateSetListener = new    DatePickerDialog.OnDateSetListener() {
    public void onDateSet(DatePicker view, int yearSelected,
            int monthOfYear, int dayOfMonth,int ) {
        year = yearSelected;
        month = monthOfYear;
        day = dayOfMonth;
    }
};
private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
    // the callback received when the user "sets" the TimePickerDialog in
    // the dialog
    public void onTimeSet(TimePicker view, int hourOfDay, int min) {
        hour = hourOfDay;
        minute = min;
        }
        };
@Override
public void onClick(View v) {
     cal = Calendar.getInstance();
        cal.set(year, month, day);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        scheduleClient.setAlarmForNotification(cal); //NullPointerException 
}
}
ScheduleClient
public class ScheduleClient {
private ScheduleService boundService;
private Context context;
 private boolean isBound;
RemindMe remindme;
public ScheduleClient(Context context) {
    super();
    this.context = context;
}
public void doBindService() {
    // TODO Auto-generated method stub
    context.bindService(new Intent(context,ScheduleService.class), Connection, Context.BIND_AUTO_CREATE);
    isBound=true;
}
 private ServiceConnection Connection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        // TODO Auto-generated method stub
        boundService=((ScheduleService.ServiceBinder) service).getService();
    }
    @Override
    public void onServiceDisconnected(ComponentName name) {
        // TODO Auto-generated method stub
        boundService=null;
    }
 };
public void doUnbindService() {
    // TODO Auto-generated method stub
    if (isBound) {
        // Detach our existing connection.
        context.unbindService(Connection);
        isBound = false;
}
   }
     public void setAlarmForNotification(Calendar cal) {
      // TODO Auto-generated method stub
       boundService.setAlarm(cal); //NullPointerException
   }
}
 
    