Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:16:34+00:00 2026-06-07T00:16:34+00:00

Hi I am trying to implement a simple application showing picasa photos in android.

  • 0

Hi I am trying to implement a simple application showing picasa photos in android.

After many trials now I use the Google Java Api Client (Not the Gdata one), to fetch the Picasa Feed.

In my program, the first layer fields of JSON in the feed (e.g. version and encoding in the code below) can be succesfully mapped, so no problem with the feed and connection
However I am unable to map the second layer fields into Objects.

I use albumFeed = response.parseAs(AlbumFeed.class);
which will invoke the parser.

From the official sample I have this AlbumFeed.java

    public class AlbumFeed {

      // cannot be List
      @Key
      List<AlbumEntry> feed;

      @Key
      String version;

      @Key
      String encoding;

}

With List <AlbumEntry> feed ;
I will get this Error, which say List cannot be initiate

06-16 14:35:10.789: E/AndroidRuntime(1129): Caused by: java.lang.IllegalArgumentException: unable to create new instance of class java.util.List because it is an interface and because it has no accessible default constructor

I changed to
ArrayList<AlbumEntry> feed
no error will be shown but the ArrayList will be empty. Can anyone advise me the correct Way to map JSON to Objects using the given JsonObjectParser?

Many thanks if anyone can answer my question

more CODE

public class newApiActivity extends Activity {

  HttpTransport transport = AndroidHttp.newCompatibleTransport();
  static final JsonFactory JSON_FACTORY = new JacksonFactory();

  public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
    return transport.createRequestFactory(new HttpRequestInitializer() {
      public void initialize(HttpRequest request) {

        // final JsonCParser jsoncparser = new JsonCParser(JSON_FACTORY);

        request.setParser(new JsonObjectParser(GSON_FACTORY));
        // request.setParser(jsoncparser);



        GoogleHeaders headers = new GoogleHeaders();
        headers.setApplicationName("APOD/1.0");
        headers.setGDataVersion("2");
        request.setHeaders(headers);
      }
    });
  }




public void mainLogic(){
HttpRequest buildGetRequest = reqFactory.buildGetRequest(url);

        HttpResponse response = buildGetRequest.execute();
        albumFeed = response.parseAs(AlbumFeed.class);

}

}

where AlbumEntry.java will be something like
I am taking the xmlns to test the behavior)

    public class AlbumEntry extends Entry {

  @Key("xmlns")
  public String xmlns;


    }

The JSON Feed itself is like:

{"version":"1.0","encoding":"UTF-8",
"feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$gphoto":"http://schemas.google.com/photos/2007,……}}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:16:35+00:00Added an answer on June 7, 2026 at 12:16 am

    Stupid me. There is nothing to do with the android/ picasa api context.

    After reading more on the GSON documentation, according to the json object {} will be a map but not an array . While array can be mapped to List, map can be mapped into an Object or Map

    I changed to simple

    @Key
    AlbumEntry feed;

    in AlbumFeed.java

    It starts working.

    A nice reference on GSON is here
    Converting JSON to Java

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to implement a simple server application in java. all it does
I'm trying to implement a simple Facebook chat application on Android. It lets the
Good Evening, I have been trying to implement a simple Android(tm) application that utilizes
I'm trying to implement some simple caching into my application and I'm having some
I am trying to implement a simple authorization strategy for my Wicket application. I
I am trying to implement simple chat application using flex. In it all my
I am new to ExtJS 4 and am trying to implement a simple application
I'm trying to implement a simple web application server as a personal project to
I am working on my first Android Application and I am trying to implement
When trying to implement a simple OpenGL application, I was surprised that while it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.