Qamran Rajput Qamran Rajput - 2 months ago 9
Android Question

different result of event.getCreator() when on kitkat and lollipop


does not return

(displayName:Qamran Rajput,,self:true) Kitkat HTC DESIRE 820

(,self:true) lollipop LG G3

Both using same Google Play Services Versions Can any one suggest how to tackle this issue please.

private List<String> getDataFromApi() throws IOException, ParseException {
// List the next 10 events from the primary calendar.
DateTime now = new DateTime(System.currentTimeMillis());
List<String> eventStrings = new ArrayList<String>();
Events events ="primary")
List<Event> items = events.getItems();

for (Event event : items) {

String id = event.getId();
DateTime start = event.getStart().getDateTime();
if (start == null) {
// All-day events don't have start times, so just use
// the start date.
start = event.getStart().getDate();
DateTime end = event.getEnd().getDateTime();

String eventTitle = event.getSummary();
String Creator = String.valueOf(event.getCreator());//string displayName:Qamran Rajput,,self:true}



Calendar Api don't returns creator name for Lollipop and Marshmellow. So you can write

if (creatorName == null) {
creatorName = "";

To avoid any Null Pointer Exception Regards