Results 1 to 2 of 2

Thread: Hello

  1. #1
    narmada132 is offline Member
    Join Date
    May 2012
    Rep Power

    Post Hello

    Hello everyone,

    URL queryUrl;
    AnalyticsService analyticsService = new AnalyticsService("gaExportAPI_acctSample_v2.0");
    List<Profile> listOfProfile = new ArrayList<Profile>();
    Profile analyticsProfile= new Profile();
    analyticsService.setAuthSubToken(accessToken, null);
    // Make request to the API.
    try {
    queryUrl = new URL("");
    AccountFeed accountFeed = analyticsService.getFeed(queryUrl, AccountFeed.class);
    for(AccountEntry accountEntry : accountFeed.getEntries()){
    analyticsProfile.setDisplayName(accountEntry.getTi tle().getPlainText());
    analyticsProfile.setProfile(accountEntry.getProper ty("ga:profileId"));
    } catch (IOException e) {
    } catch (ServiceException e) {
    } catch (UnsupportedOperationException e) {

    return listOfProfile;


    Here the above code is for getting some feed from the queryUrl.
    Here I have to get the entries in the accountFeed, for that i use accountEntry.
    But problem here im encountered with is whatever the entries in the accountEntry i've to iterate it and get into my List<Profile>, where while iterating whatever the element is iterated it should appended to the end of the list but here after first iteration whatever analyticProfile object is having is added to list but at the second iteration the analyticProfile is appended to the list but it is added twice eliminating the first iterated value of analyticProfile into the list and so on which is resulting in duplicates and able to get the list of elements with a values in last iterated object in the entries.

    I've tried to sort out the problem a lot but could not understand where exactly the problem is......

    Plz do the is an urgent code which i need to sort out.

    I request anybody who could help me on this as soon as possible.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Hello

    Moved from Suggestions and Feedback. The page for that section has a by-line
    Something you do or don't like? Let us know. This is also the place for questions regarding this forum.
    What made you think it was the appropriate section to post your question?

    Please go through the following:
    Forum Rules
    BB Code List - Java Programming Forum

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

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