I try to pass a String: "2.10.2017 - 15.10.2017" into a Calendar as the period of this appointment. To do this, i split this string into two strings, remove all spaces and store it in two strings this is working fine, but if i try to convert this two strings into two date objects, my startdate is right but my enddate is completely different to the actual date. Here is my Code what i tried:
String date = "2.10.2017 - 15.11.2017";
if (date.contains("-")){
String[] parts = date.split("\\-");
String part1 = parts[0].trim(); // 004
String part2 = parts[1].trim(); // 034556
Calendar startcal = Calendar.getInstance();
Calendar endcal = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
try {
startcal.setTime(df.parse(part1));
} catch (ParseException e) {
e.printStackTrace();
}
DateFormat dd = new SimpleDateFormat("dd.MM.yyyy");
try {
endcal.setTime(dd.parse(part2));
Toast.makeText(getApplicationContext(),"Part2"+part2,Toast.LENGTH_LONG).show();
} catch (ParseException e) {
e.printStackTrace();
}
setupcalendar(startcal,endcal);
}else {
Calendar startcal = Calendar.getInstance();
Calendar endcal = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
try {
startcal.setTime(df.parse(date));
} catch (ParseException e) {
e.printStackTrace();
}
try {
endcal.setTime(df.parse(date));
} catch (ParseException e) {
e.printStackTrace();
}
setupcalendar(startcal,endcal);
}
}
});
}
private void setupcalendar(Calendar startcal, Calendar endcal) {
Calendar cal = Calendar.getInstance();
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime", startcal.getTimeInMillis());
intent.putExtra("allDay", true);
intent.putExtra("rrule", "FREQ=YEARLY");
intent.putExtra("endTime", endcal.getTimeInMillis());
intent.putExtra("title", data.get("name"));
startActivity(intent);
}
in this example i received this enddate: 26.09.2017. I dont know why regards
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I want to try to save datapayload pushed from firebase to firebase database, also I want to access this saved data with previous or back buttons, Is it possible to do this ?
I've been working with Android Studio in the past month,and built an App that works with Firebase Auth/db and Paypal APII wanted to hear some updated opinion on any Android tools or frameworks that's flexible and make mobile development more efficient
I have a legacy Cocos2D game projectWhen compiling Android version, I get a lot of warnings: