2

I want to create bundle timeline card. What I did so far.

Create three card and add in a list.

public void makeStartTimelineBundle(Credential credential) {
    List<TimelineItem> timeLineList = new ArrayList<TimelineItem>();

    TimelineItem startTimelineItem = new TimelineItem();
    TimelineItem helpTimelineItem1 = new TimelineItem();
    TimelineItem helpTimelineItem2 = new TimelineItem();

    startTimelineItem.setId("startTimelineItem");
    helpTimelineItem1.setId("helpTimelineItem1");
    helpTimelineItem2.setId("helpTimelineItem2");

    startTimelineItem.setBundleId("startCard");

    startTimelineItem.setText("startTimelineItem");
    helpTimelineItem1.setText("helpTimelineItem1");
    helpTimelineItem2.setText("helpTimelineItem2");

    timeLineList.add(startTimelineItem);
    timeLineList.add(helpTimelineItem1);
    timeLineList.add(helpTimelineItem2);

    try {
        MirrorClient.insertListTimelineItem(credential, timeLineList);
    }catch (IOException iOE) {
        log.info("Error : " + iOE);
    }
}

Then execute through MirrorClient

// list timeline
public static TimelineItem insertListTimelineItem(Credential credential,
    List<TimelineItem> items) throws IOException {

    for (TimelineItem item : items) {
        return getMirror(credential).timeline().insert(item).execute();
    }
    return null;
} 

When I run the code in my glass I just get First timeline card. How I create bundle of timeline card?

Prisoner
  • 49,922
  • 7
  • 53
  • 105
Moddasir
  • 1,449
  • 13
  • 33

1 Answers1

5

It looks like you're only setting the bundleId of one of the timeline items that you want to have in the bundle. In order to create a bundle, set all of the timeline items to have the same bundleId.

You should also not be setting the id of the card manually — that is generated by the Mirror API when the item is inserted.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • if i do not set 'bundleId' then how mirror api understand all the timeline is in one bundle? another thing is, now it is working with same 'bundleId', with first timeline 'text'. but I set different 'text' for different timeline. – Moddasir Nov 25 '13 at 08:41