I tried to do to fetch the data's between from and to dates. I did it on sql lite,it works and I tried in android coding part,it doesn't work,could you guys please help
protected void adddata1() throws ParseException {
Database db=new Database(Reportmonth.this);
SQLiteDatabase sb=db.getReadableDatabase();
String a=from.getText().toString();
String b=to.getText().toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 Date a1=sdf.parse(a);//convert string to date
Date b1=sdf.parse(b);//convert string to date
Cursor cus=sb.rawQuery("select * from expenz where daty between '" + a1 +"' AND '"+b1+"'",null);
cus.moveToFirst();
 for(int i=0;i<cus.getCount();i++)
     {
     if(cus!=null) //i think the error starts from this onwards.        
     {                           
         soi.setText(cus.getString(0));
         Log.i("",cus.getString(0));
          desc.setText(cus.getString(3));
          dat.setText(cus.getString(1));
          woc.setText(cus.getString(2));
          amount.setText(cus.getString(5));
          adddata();
          search.setClickable(false);
  }      
     cus.moveToNext();
     } 
    }
 
     
    