FAQ Database Discussion Community

Convert Tue Dec 09 00:00:00 GMT+04:00 2014 to yyyy-MM-dd android

The code below produces error Caused by: java.lang.NullPointerException at java.util.Calendar.setTime. Is it the right way to convert "Tue Dec 09 00:00:00 GMT+04:00 2014" to yyyy-MM-dd android using simpledateformat SimpleDateFormat parseFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Date date = null; try { date = parseFormat.parse(dateString); System.out.println("Cresult_pass: "+date.toString()); SimpleDateFormat...

Android - Get Unix time stamp for beginning and end of day

I have an SQLite database that has an integer column to store a unix time stamp and I need to be able to query this column for specific days. I am looking for a method to return the Unix time for the beginning and end of a given day. What...

How to get the selected date from android TimeSquare library?

How to get user selected date from android TimeSquare library? I used getselectedate() but it didn't work and OnClickListener also not working with this. public class HomeActivity extends Activity { private String dateHolder; private CalendarPickerView calenderView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); calenderView = (CalendarPickerView) findViewById(R.id.calendar_view); calenderView.init(lastYear.getTime(), nextYear.getTime())...

Parse CalendarContract.Events.DURATION values

I'm querying my calendar and showing all events result. When i'm trying to parse the value CalendarContract.Events.DURATION i'm getting a RFC2445 string format. For example i'm getting "P15M" which I know it's 15 minutes meeting. After digging on the internet on how to parse RFC2445 I've found some google jar...

Difference between LG default calendar and Google calendars

On my LG-G3 there is a default calendar named "Phone". It's not Google's. I build an application which syncs events with the user's Google Calendars, but when I select all the calendars with a query - I get the "Phone" calendar too. Since it's not a Google calendar, I can't...

AlarmManager or CalendarProvider, What should be used for an app like Keep or Evernote?

I am developing an android application just like Google Keep and Evernote. Now I want to add many reminders or alarms one time and repeated too. I have both options and I am confused.

Android, Listener/Observer/Callback on calendar event change

I am writing an application that needs to know when a meeting is added/removed/changed in the calendar. I know how to get all the data from a calendar using CursorLoader on the calendar uri. Also i know how to listen to calendar changes using the ContentObserver. The problem is that...

Parse date from string to get miliseconds

I'm trying to get the miliseconds from an string that contains a date, but seems that im getting the wrong value. This is the string im trying to parse: 2015-03-01 00:00:00, I'm doing this to parse it: DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); Date inputDate = dateFormat.parse(data.get(position).getValidTo()); Log.d("--", inputDate.getDay() +...

CalendarView Error to Display Multiple Highlights

How To Highlight Multiple Days according to Calculation Hi. please help me how to do this. package com.tgkjer.fertilitystress; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import...

Custom DatePicker On EditText

I have 2 EditText. When anyone click on a EditText datepicker is displayed to set date in EditText. so my coding for EditText is sdate.setOnTouchListener( new DrawableClickListener.RightDrawableClickListener(sdate) { @Override public boolean onDrawableClick() { MyDatePickerDialog(sdate);// put edit text view. return true; } } ); edate.setOnTouchListener( new DrawableClickListener.RightDrawableClickListener(edate) { @Override public boolean...

Unparseable date. Parse Exception comparing two dates

I am trying to produce a list based on a date. I keep getting a Parse exception. I thought I had the dates in the exact same format. Maybe I missed something. I have played with this for hours with no success. Any help would be appreciated. public static List<String>...

Remaining days calculation in java

I have implemented the following code to calculate the remaining days left. I have used SimpleDateFormat to convert string to date. If I enter 10/02/1993 (today's date) as the date, the output shows 0 days left. But if I choose 11/02/1993, it shows the same output as 0 days left....

Weekly Calendar calculation in Android

Trying to develop an application similar to stock calendar. I am trying weekly view on my app. I have the current weeks date showing up properly. Now I am trying to get the previous and Next week calculation done. I tried the following for previous Calculation: if(calender.get(Calendar.WEEK_OF_YEAR) == calender.getActualMinimum(Calendar.WEEK_OF_YEAR)) {...