Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by Yul ( 14 years ago )
if(reurrence.equals("true"))
{
Cursor c1=db.recctable();
startManagingCursor(c1); ---------->This is from table 2.
do {
System.out.println("No="+c1.getString(c1.getColumnIndex("startdate")));
String dates=(c1.getString(c1.getColumnIndex("startdate")));
String types=(c1.getString(c1.getColumnIndex("recurrencetype")));
int recc=Integer.parseInt((c1.getString(c1.getColumnIndex("increment"))));
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String currentDateandTime = sdf.format(new Date());
Calendar cal=Calendar.getInstance();
Date dt=null;
try
{
dt = sdf.parse(dates);
cal.setTime(dt);
} catch (ParseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
int daysInSameMonth=0; ------------------>For getting this value only i am doing this..It gives always the first entry count.
int count[]=new int[c1.getCount()];
for(int j=1;j<recc;j++)
{
int currentDay= cal.get(Calendar.DAY_OF_MONTH);
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
System.out.println("b4 inc");
daysInSameMonth++;
if(types.equals("Daily"))
{
cal.add(Calendar.DAY_OF_MONTH, 1);
Date dtNew=cal.getTime();
cal.setTime(dtNew);
if(currentDay==lastDay)
{
System.out.println("count="+daysInSameMonth);
break;
}
// System.out.println("days="+daysInSameMonth[i]);
}
else if(types.equals("Weekly"))
{
System.out.println("Inside week");
System.out.println("current="+currentDay);
System.out.println("last="+lastDay);
cal.add(Calendar.DAY_OF_MONTH, 7);
if(currentDay<=lastDay)
{
break;
}
}
}
System.out.println("subbu="+daysInSameMonth);
System.out.println("totttt="+daysInSameMonth*total);
recctotal=String.valueOf(daysInSameMonth*total);
text9.setText(recctotal);
} while (c1.movenext())
}
Revise this Paste