Moddasir
Moddasir

Reputation: 1459

How to create bundle timeline card

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?

Upvotes: 2

Views: 289

Answers (1)

Tony Allevato
Tony Allevato

Reputation: 6429

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.

Upvotes: 5

Related Questions