Results 1 to 6 of 6
- 04-26-2010, 05:22 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 3
- Rep Power
- 0
Flickr Api - trouble return Date objects
Hi,
I am very new to Java, so I'm fairly sure that my problem is a language and procedural one as opposed to anything to do with the flickrJ API. I am fairly sure that my issue is a casting one, although again I'm not sure of that.
I am able to post code but again I'm not sure what parts of it are relevant so I thought that I might explain my problem with a bit of pseudo code!
so in the FlickrJ package the Photo class has a number of methods to get information about the photo. I have basically been following the tutorial written for processing (the Java based artists/designers coding software), but developing in Eclipse. I have successfully implemented the getSmallUrl() method after completing a search and have displayed those photos using Processings pApplet.
The above code works fine.Java Code:try{ //we are looking for n photots starting at page 0 PhotoList list = photos.search(sp,n,0); //Grab all the image paths and store them in a string array String[] smallURLS = new String[list.size()]; for(int i=0; i <list.size(); i++){ //we can get a lot more info from a photo than just its URL path //we need to create an object to store each photo and ALL of its info in. Photo p = (Photo)list.get(i); smallURLS[i] = p.getSmallUrl(); } return smallURLS; }catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (FlickrException e) { e.printStackTrace(); } return null; }
so my understanding was that i could call the method getDateAdded(), from my photo object p and receive the date in the form Java.Util.Date.
(from the documentation)
getDateAdded
public java.util.Date getDateAdded()
-------------------
But when i enterafter I created the p photo object - a recieve a null replyJava Code:System.out.println((Date) p.getDatePosted());
I have looked on the flickr API, and as far as I can tell every upload is time stamped so I don't think that null is an appropriate response, or am I missing something.
Any help, or suggestions where I might go to solve my problem are much appreciated. I am teaching myself to code and although I am thoroughly enjoying it, its difficult going by yourself, so I appreciate all the help I can get.
Cheers
Tim
- 04-26-2010, 05:57 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
getDateAdded()...getDatePosted()?
Which is it?
- 04-27-2010, 12:39 AM #3
Member
- Join Date
- Apr 2010
- Posts
- 3
- Rep Power
- 0
Hey,
Thanks for the reply. Its getDateAdded(), I mistyped although both methods should return a Date object, and I am getting a null response for both of them.
(I tried getPostAdded() just now for interests sake)
I seem to be doing something wrong.
- 04-27-2010, 09:52 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
And you're not getting any exceptions?
But you are getting the URLs?
- 04-27-2010, 01:32 PM #5
Member
- Join Date
- Apr 2010
- Posts
- 3
- Rep Power
- 0
Hey,
Yeah no other errors. and I'm getting the URL's to display the photos fine, and they are being displayed.
After much deliberation, I have a feeling that the getDate methods have been created, but not completely filled out with code - is that possible?
The reason why I think this is because I found a guy who had a similar problem on the Flickr forums. No one replied to his questions, but it made me think that it may not just have been me.
Also I tried a number of other properties of the photos. get size, get user, etc. Some worked, but a lot didn't. So I have a feeling the class hasn't been fleshed out completely.
The weird thing is I'm pretty certain that when I use date information as search criteria - ie only photos in the last day. That information is parsed and used correctly.
--
I just thought of this, is there a way to look into the FlickrJ library itself to find out if this hunch is correct?
Thanks for your efforts
- 04-27-2010, 04:06 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
Trouble working with/calling Objects! Any Help?
By ramathews in forum New To JavaReplies: 4Last Post: 03-24-2010, 02:50 PM -
an API can return objects without making their classes public
By parthu_lkp in forum Advanced JavaReplies: 1Last Post: 08-11-2009, 02:00 PM -
Return objects called
By MV1 in forum New To JavaReplies: 7Last Post: 03-11-2009, 07:16 AM -
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 08:10 AM -
Creating a Gregorian Calendar using a Date object gives date - 1
By prachi_goliwadekar in forum New To JavaReplies: 1Last Post: 05-08-2008, 08:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks