Click here to Skip to main content
11,577,643 members (23,461 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
I want to convert this objective c code to equivalent to pure android in java.

This is " objective c " code:


frDateStr=[NSString stringWithFormat:@"1505%d",theYear];
toDateStr=[NSString stringWithFormat:@"0109%d",theYear];
 

fromDate=[dFormatter dateFromString:frDateStr];
toDate=[dFormatter dateFromString:toDateStr];
 
fromInter=[fromDate timeIntervalSinceReferenceDate];
toInter=[toDate timeIntervalSinceReferenceDate];
currDateInter=[[NSDate date] timeIntervalSinceReferenceDate];
 
//Current date exists when :
//If currentdate interval is greater or equal to fromdate interval..
//or if currentdate interval is less or equal to todate interval
if([yearName isEqualToString:@"Senior"])
{
    if((int)currDateInter >= (int)fromInter && (int)currDateInter <= (int)(toInter))
    {
 
        if(![self.ignoredArray containsObject:@"Freshman Budget"] && [yearName isEqualToString:@"Senior"])
        {
            [self.currentRemindersArray addObject:@"Freshman Budget"];
 
        }
    }
 

 

}


Can anyone help me please? Thank you.
Posted 26-Aug-12 20:49pm
Edited 26-Aug-12 22:42pm
v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here is the solution:For Android equivalent.


String startingFrom = "05-15-"+ currentYear;
			String endingDate = "09-10-"+ currentYear;
		
		 	SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
		    Date CurrentDate = new Date();
	    	
		    Date fromConvertedDate = new Date();
			Date toConvertedDate = new Date();
			try {
				fromConvertedDate = dateFormat.parse(startingFrom);
				toConvertedDate = dateFormat.parse(endingDate);
				//CurrentDate =dateFormat.parse(CurrentDatei);
				
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			 
		 	if (yearName.equalsIgnoreCase("Senior")) {
 
				if (CurrentDate.after(fromConvertedDate)
						&& CurrentDate.before(toConvertedDate)) {
					
      // Freshman Budget
					
					Cursor cursorC = myDbHelper.retrieveAllReminders("Freshman Budget ");
					
					
					if (cursorC.moveToFirst()) {
						
							ReminderVO reminderVO = new ReminderVO();
 
 							String data = cursorC.getString(cursorC
									.getColumnIndex("Title"));
							String data1 = cursorC.getString(cursorC
									.getColumnIndex("Description"));
							reminderVO.setEntryDescription(data1);
							reminderVO.setEntryTitle(data);
							arr2ListItems.add(reminderVO);
 
						
							listView.setAdapter(new CustomListAdapter(this,
									arr2ListItems));
						
					}
					cursorC.moveToFirst();
 
				}}
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 180
1 OriginalGriff 115
2 Richard MacCutchan 100
3 Abhinav S 90
4 Peter Leow 80
0 OriginalGriff 820
1 Sergey Alexandrovich Kryukov 681
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 375


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100