Results 1 to 6 of 6
  1. #1
    red_beardo is offline Member
    Join Date
    Apr 2010
    Posts
    3
    Rep Power
    0

    Default 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.

    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;
     
        }
    The above code works fine.

    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 enter
    Java Code:
    	System.out.println((Date) p.getDatePosted());
    after I created the p photo object - a recieve a null reply


    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

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    getDateAdded()...getDatePosted()?
    Which is it?

  3. #3
    red_beardo is offline Member
    Join Date
    Apr 2010
    Posts
    3
    Rep Power
    0

    Default

    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.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    And you're not getting any exceptions?
    But you are getting the URLs?

  5. #5
    red_beardo is offline Member
    Join Date
    Apr 2010
    Posts
    3
    Rep Power
    0

    Default

    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

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    No idea, never used it.
    Do they supply source files with it?

Similar Threads

  1. Trouble working with/calling Objects! Any Help?
    By ramathews in forum New To Java
    Replies: 4
    Last Post: 03-24-2010, 02:50 PM
  2. Replies: 1
    Last Post: 08-11-2009, 02:00 PM
  3. Return objects called
    By MV1 in forum New To Java
    Replies: 7
    Last Post: 03-11-2009, 07:16 AM
  4. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 08:10 AM
  5. Creating a Gregorian Calendar using a Date object gives date - 1
    By prachi_goliwadekar in forum New To Java
    Replies: 1
    Last Post: 05-08-2008, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •