Hello Friends,
Have you Searching for Android calender syncing in your android app.Displaying
all the events, birthday, reminder and meeting In your android app. Today I am sharing my
another android tutorial for android custom calendar view and listing all the calendar
event in my own android app. It is a small sample application for syncing of android
calender events.
1. CalendarView.java
2. CalendarAdapter.java
3. Utility.java
Download the complete Source code
Calenderview.zip
Enjoy coding :)
Have you Searching for Android calender syncing in your android app.Displaying
all the events, birthday, reminder and meeting In your android app. Today I am sharing my
another android tutorial for android custom calendar view and listing all the calendar
event in my own android app. It is a small sample application for syncing of android
calender events.
android calander syncing |
1. CalendarView.java
package com.examples.android.calendar; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.Locale; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; public class CalendarView extends Activity { public GregorianCalendar month, itemmonth;// calendar instances. public CalendarAdapter adapter;// adapter instance public Handler handler;// for grabbing some event values for showing the dot // marker. public ArrayListitems; // container to store calendar items which // needs showing the event marker ArrayList event; LinearLayout rLayout; ArrayList date; ArrayList desc; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calendar); Locale.setDefault(Locale.US); rLayout = (LinearLayout) findViewById(R.id.text); month = (GregorianCalendar) GregorianCalendar.getInstance(); itemmonth = (GregorianCalendar) month.clone(); items = new ArrayList (); adapter = new CalendarAdapter(this, month); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(adapter); handler = new Handler(); handler.post(calendarUpdater); TextView title = (TextView) findViewById(R.id.title); title.setText(android.text.format.DateFormat.format("MMMM yyyy", month)); RelativeLayout previous = (RelativeLayout) findViewById(R.id.previous); previous.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setPreviousMonth(); refreshCalendar(); } }); RelativeLayout next = (RelativeLayout) findViewById(R.id.next); next.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setNextMonth(); refreshCalendar(); } }); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { // removing the previous view if added if (((LinearLayout) rLayout).getChildCount() > 0) { ((LinearLayout) rLayout).removeAllViews(); } desc = new ArrayList (); date = new ArrayList (); ((CalendarAdapter) parent.getAdapter()).setSelected(v); String selectedGridDate = CalendarAdapter.dayString .get(position); String[] separatedTime = selectedGridDate.split("-"); String gridvalueString = separatedTime[2].replaceFirst("^0*", "");// taking last part of date. ie; 2 from 2012-12-02. int gridvalue = Integer.parseInt(gridvalueString); // navigate to next or previous month on clicking offdays. if ((gridvalue > 10) && (position < 8)) { setPreviousMonth(); refreshCalendar(); } else if ((gridvalue < 7) && (position > 28)) { setNextMonth(); refreshCalendar(); } ((CalendarAdapter) parent.getAdapter()).setSelected(v); for (int i = 0; i < Utility.startDates.size(); i++) { if (Utility.startDates.get(i).equals(selectedGridDate)) { desc.add(Utility.nameOfEvent.get(i)); } } if (desc.size() > 0) { for (int i = 0; i < desc.size(); i++) { TextView rowTextView = new TextView(CalendarView.this); // set some properties of rowTextView or something rowTextView.setText("Event:" + desc.get(i)); rowTextView.setTextColor(Color.BLACK); // add the textview to the linearlayout rLayout.addView(rowTextView); } } desc = null; } }); } protected void setNextMonth() { if (month.get(GregorianCalendar.MONTH) == month .getActualMaximum(GregorianCalendar.MONTH)) { month.set((month.get(GregorianCalendar.YEAR) + 1), month.getActualMinimum(GregorianCalendar.MONTH), 1); } else { month.set(GregorianCalendar.MONTH, month.get(GregorianCalendar.MONTH) + 1); } } protected void setPreviousMonth() { if (month.get(GregorianCalendar.MONTH) == month .getActualMinimum(GregorianCalendar.MONTH)) { month.set((month.get(GregorianCalendar.YEAR) - 1), month.getActualMaximum(GregorianCalendar.MONTH), 1); } else { month.set(GregorianCalendar.MONTH, month.get(GregorianCalendar.MONTH) - 1); } } protected void showToast(String string) { Toast.makeText(this, string, Toast.LENGTH_SHORT).show(); } public void refreshCalendar() { TextView title = (TextView) findViewById(R.id.title); adapter.refreshDays(); adapter.notifyDataSetChanged(); handler.post(calendarUpdater); // generate some calendar items title.setText(android.text.format.DateFormat.format("MMMM yyyy", month)); } public Runnable calendarUpdater = new Runnable() { @Override public void run() { items.clear(); // Print dates of the current week DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US); String itemvalue; event = Utility.readCalendarEvent(CalendarView.this); Log.d("=====Event====", event.toString()); Log.d("=====Date ARRAY====", Utility.startDates.toString()); for (int i = 0; i < Utility.startDates.size(); i++) { itemvalue = df.format(itemmonth.getTime()); itemmonth.add(GregorianCalendar.DATE, 1); items.add(Utility.startDates.get(i).toString()); } adapter.setItems(items); adapter.notifyDataSetChanged(); } }; }
2. CalendarAdapter.java
package com.examples.android.calendar; 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 android.widget.TextView; public class CalendarAdapter extends BaseAdapter { private Context mContext; private java.util.Calendar month; public GregorianCalendar pmonth; // calendar instance for previous month /** * calendar instance for previous month for getting complete view */ public GregorianCalendar pmonthmaxset; private GregorianCalendar selectedDate; int firstDay; int maxWeeknumber; int maxP; int calMaxP; int lastWeekDay; int leftDays; int mnthlength; String itemvalue, curentDateString; DateFormat df; private ArrayListitems; public static List dayString; private View previousView; public CalendarAdapter(Context c, GregorianCalendar monthCalendar) { CalendarAdapter.dayString = new ArrayList (); Locale.setDefault(Locale.US); month = monthCalendar; selectedDate = (GregorianCalendar) monthCalendar.clone(); mContext = c; month.set(GregorianCalendar.DAY_OF_MONTH, 1); this.items = new ArrayList (); df = new SimpleDateFormat("yyyy-MM-dd", Locale.US); curentDateString = df.format(selectedDate.getTime()); refreshDays(); } public void setItems(ArrayList items) { for (int i = 0; i != items.size(); i++) { if (items.get(i).length() == 1) { items.set(i, "0" + items.get(i)); } } this.items = items; } public int getCount() { return dayString.size(); } public Object getItem(int position) { return dayString.get(position); } public long getItemId(int position) { return 0; } // create a new view for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; TextView dayView; if (convertView == null) { // if it's not recycled, initialize some // attributes LayoutInflater vi = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.calendar_item, null); } dayView = (TextView) v.findViewById(R.id.date); // separates daystring into parts. String[] separatedTime = dayString.get(position).split("-"); // taking last part of date. ie; 2 from 2012-12-02 String gridvalue = separatedTime[2].replaceFirst("^0*", ""); // checking whether the day is in current month or not. if ((Integer.parseInt(gridvalue) > 1) && (position < firstDay)) { // setting offdays to white color. dayView.setTextColor(Color.WHITE); dayView.setClickable(false); dayView.setFocusable(false); } else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) { dayView.setTextColor(Color.WHITE); dayView.setClickable(false); dayView.setFocusable(false); } else { // setting curent month's days in blue color. dayView.setTextColor(Color.BLUE); } if (dayString.get(position).equals(curentDateString)) { setSelected(v); previousView = v; } else { v.setBackgroundResource(R.drawable.list_item_background); } dayView.setText(gridvalue); // create date string for comparison String date = dayString.get(position); if (date.length() == 1) { date = "0" + date; } String monthStr = "" + (month.get(GregorianCalendar.MONTH) + 1); if (monthStr.length() == 1) { monthStr = "0" + monthStr; } // show icon if date is not empty and it exists in the items array ImageView iw = (ImageView) v.findViewById(R.id.date_icon); if (date.length() > 0 && items != null && items.contains(date)) { iw.setVisibility(View.VISIBLE); } else { iw.setVisibility(View.INVISIBLE); } return v; } public View setSelected(View view) { if (previousView != null) { previousView.setBackgroundResource(R.drawable.list_item_background); } previousView = view; view.setBackgroundResource(R.drawable.calendar_cel_selectl); return view; } public void refreshDays() { // clear items items.clear(); dayString.clear(); Locale.setDefault(Locale.US); pmonth = (GregorianCalendar) month.clone(); // month start day. ie; sun, mon, etc firstDay = month.get(GregorianCalendar.DAY_OF_WEEK); // finding number of weeks in current month. maxWeeknumber = month.getActualMaximum(GregorianCalendar.WEEK_OF_MONTH); // allocating maximum row number for the gridview. mnthlength = maxWeeknumber * 7; maxP = getMaxP(); // previous month maximum day 31,30.... calMaxP = maxP - (firstDay - 1);// calendar offday starting 24,25 ... /** * Calendar instance for getting a complete gridview including the three * month's (previous,current,next) dates. */ pmonthmaxset = (GregorianCalendar) pmonth.clone(); /** * setting the start date as previous month's required date. */ pmonthmaxset.set(GregorianCalendar.DAY_OF_MONTH, calMaxP + 1); /** * filling calendar gridview. */ for (int n = 0; n < mnthlength; n++) { itemvalue = df.format(pmonthmaxset.getTime()); pmonthmaxset.add(GregorianCalendar.DATE, 1); dayString.add(itemvalue); } } private int getMaxP() { int maxP; if (month.get(GregorianCalendar.MONTH) == month .getActualMinimum(GregorianCalendar.MONTH)) { pmonth.set((month.get(GregorianCalendar.YEAR) - 1), month.getActualMaximum(GregorianCalendar.MONTH), 1); } else { pmonth.set(GregorianCalendar.MONTH, month.get(GregorianCalendar.MONTH) - 1); } maxP = pmonth.getActualMaximum(GregorianCalendar.DAY_OF_MONTH); return maxP; } }
3. Utility.java
package com.examples.android.calendar; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import android.content.Context; import android.database.Cursor; import android.net.Uri; public class Utility { public static ArrayListnameOfEvent = new ArrayList (); public static ArrayList startDates = new ArrayList (); public static ArrayList endDates = new ArrayList (); public static ArrayList descriptions = new ArrayList (); public static ArrayList readCalendarEvent(Context context) { Cursor cursor = context.getContentResolver() .query(Uri.parse("content://com.android.calendar/events"), new String[] { "calendar_id", "title", "description", "dtstart", "dtend", "eventLocation" }, null, null, null); cursor.moveToFirst(); // fetching calendars name String CNames[] = new String[cursor.getCount()]; // fetching calendars id nameOfEvent.clear(); startDates.clear(); endDates.clear(); descriptions.clear(); for (int i = 0; i < CNames.length; i++) { nameOfEvent.add(cursor.getString(1)); startDates.add(getDate(Long.parseLong(cursor.getString(3)))); endDates.add(getDate(Long.parseLong(cursor.getString(4)))); descriptions.add(cursor.getString(2)); CNames[i] = cursor.getString(1); cursor.moveToNext(); } return nameOfEvent; } public static String getDate(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); } }
Download the complete Source code
Calenderview.zip
Enjoy coding :)
Hello Mukesh,
ReplyDeleteI have just implement same app like this for the event as a dot which display events. please share the code for this.
THanks in Advance.
Hello Mukesh,
ReplyDeleteI also need to implement app like this. please share the code for this as soon as possible.
Thanks in Advance.
Hello Piyush
ReplyDeleteI just doing some re factoring work in the code so I will provide the code soon, may be today evening with complete tutorial with the source code.
can you provide the link of tutorials
DeleteThis comment has been removed by the author.
ReplyDeleteHello Mukesh,
ReplyDeleteIn this calendar is the event which is display as dot is a static data???
Hello Mukesh,
ReplyDeleteI have downloaded the code but in this the dot does't appear according to event.
Hello Piyush,
ReplyDeleteIn this calendar demo code I am using Static Array list for storing the event.But the good practice is to make a class Object for storing the data and then fetching the data from it.
Hello mukesh can you share youe email id please??
ReplyDeleteI am surprised , the same code I was using on my Htc phone and its fetching all my calendar events.
ReplyDeletemy email id is : mukesh421985@gmail.com
Yes..But right now i am testing the app on emulator. And is it necessary to create a calendar account for that??
ReplyDeleteOkay, how it get the calender instance on emulator may be this is the one reason of getting
ReplyDeleteunexpected result.
In android phone there is a calender application. So try to run this sample on real android device instead of emulator. Also before running this please be sure that calendar application will be installed on your device, as in lower version of device (2.2,2.3) we have to download the calender app from google market.
OK..... But i have a little bit confusion when i have run this on real device then first no event display..but after enter in calendar app i have create a event so i can see event in this app as dot...so my que. is my data is coming from server so for add event everytime i have to go to calendar app???
ReplyDeleteYes , If you device is sync with gmail account or you are login with gamil then its show all your google calendar event. Else you have to add manually.
ReplyDeleteIn your case as your data is coming from backend , you don't need to add it in the calendar app every time. Simply store all events in an object in key value pair(eg:1/1/2013=>new year). And in
my above custom calender view code when I am populating or creating the calender view at that time I am checking if the calendar date is present in the object or not. if there is a date present in object , I just fetch the calender event corresponding to that date and bind it on the calendar.
Check the logic where I am binding the event on that date from array object,and try the above approach which I said.I am sure its work charm for you.
i'm also copy paste this code but not getting run this app it force close at cursor event able columns not found.
ReplyDeleteHello Prashant,
ReplyDeleteI think your are execution this code in your android emulator.
Try to run on android device then let me know if it is still crashing or not.
I have test this code on HTC Explorer v-2.2.Its working fine.
HI mukesh i have downloaded u r program and i run in mobile but i am getting this error
ReplyDeletejava.lang.SecurityException: Permission Denial: reading com.android.providers.calendar.CalendarProvider2 uri content://com.android.calendar/events from pid=2211, uid=10251 requires android.permission.READ_CALENDAR
Hello Soma,
ReplyDeleteThis is a permission issue,Please add Calendar permission in your AndroidManifest.xml file.
android.permission.READ_CALENDAR
Hey thanks Mukesh its works me fine, can u guide me how to add Events in Calender, like Birthday , meeting and i want to keep alarm for that , It is possible??
ReplyDeleteThanks and welcome..
ReplyDeleteYes, we can add alarm also.
1. Regarding adding the event, its depends on you from where you are getting these event,(I mean by webservice). If you simply syncing the google calendar then simply open your google calendar add all meetings,event or birthday.These appliction will fetch all those events in the custom calendar.
Thanks for the reply ,
ReplyDeleteI am not getting the event form webservice, i just want to add the event my manually. and i want to set the alarm for that . any idea
I need to list out all tthe events of the selected month in a page ?? how can i ??? pls help me
ReplyDeleteHello,
ReplyDeleteYou have to make few change in above code...in my code I am comparing the current date with map of date event and binding all the event of current date.So before that you check the month and then even...few extra looping required in above code.
Hopes now you got some idea.
Hi mukesh
ReplyDeletei wants to add the events in ur code, so tell me in which area i have to modify ur code. how to get the that dot . in calender view
check this method in CalendarView.java class....
ReplyDeletepublic Runnable calendarUpdater = new Runnable() {
---
---
}
Also Utility.startDates , here I am storing all events in an arraylist.
Hello Mekesh Yadav, i'm a student in Korea.
ReplyDeletei need ur code for my app for contest.
So, can i use ur codes for my app?
i will be appreciate for ur kindness
Thank you
Yes , sure not an issue.
ReplyDeleteThree questions.
ReplyDeleteHow do you get the window popped-up when a user presses on a specific date for more information. And at the same time, the user closes the window when the user exits the window.
How do you have a 'quote' displayed on the bottom of the calendar and having it played (like a scroll from right to left) for each of the dates
On what database would you recommend to sync the calendar and the information on specific dates?
Thank you.
Hello Mukesh,
ReplyDeleteThanks for nice post. I would like to add manually add event to your custom calendar not to device's built in calendar or else. Already I have tried to do this on the following portion:
public Runnable calendarUpdater = new Runnable()
{
@Override
public void run()
{
items.clear();
// Print dates of the current week
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String itemvalue;
event = Utility.readCalendarEvent(CalendarView.this);
Log.d("=====Event====", event.toString());
Log.d("=====Date ARRAY====", Utility.startDates.toString());
for (int i = 0; i < Utility.startDates.size(); i++)
{
itemvalue = df.format(itemmonth.getTime());
itemmonth.add(GregorianCalendar.DATE, 1);
items.add(Utility.startDates.get(i).toString());
}
adapter.setItems(items);
adapter.notifyDataSetChanged();
}
};
but I am not able to do that. Can you please provide the code for this ? Then it will help me to learn this thing.
hey wen i am running your code on device its crashing giving following error trace
ReplyDelete08-01 12:06:36.180: E/AndroidRuntime(12883): java.lang.NumberFormatException: Invalid long: "null"
08-01 12:06:36.180: E/AndroidRuntime(12883): at java.lang.Long.invalidLong(Long.java:125)
08-01 12:06:36.180: E/AndroidRuntime(12883): at java.lang.Long.parseLong(Long.java:342)
08-01 12:06:36.180: E/AndroidRuntime(12883): at java.lang.Long.parseLong(Long.java:319)
08-01 12:06:36.180: E/AndroidRuntime(12883): at com.examples.android.calendar.Utility.readCalendarEvent(Utility.java:36)
08-01 12:06:36.180: E/AndroidRuntime(12883): at com.examples.android.calendar.CalendarView$1.run(CalendarView.java:184)
Hello Mukesh i want to display calender inside the alert dialog exact like you so how to do this.
ReplyDeleteThanks,
Android Developer.
Hi Mukesh,
ReplyDeleteI need to add events for the particular date. can
u share ur code for the events..
Hello Pavithra,
ReplyDeleteYou just need to change the array list of date according to your need in Utility class, and rest remain same.
Thank you Mukesh
ReplyDeleteCan u send ur code i just implement that and i ll change as per my requirements.. this is mail id pavithra.viji16@gmail.com..If u send that ll be very useful for me
ReplyDeletehai Mukesh,,
ReplyDeleteCan i please know about the license terms of this project???
can you please help me out with license terms of this project Mr.Mukesh???
ReplyDeleteHello Rakesh,
ReplyDeletethis is an open source code demo, there is no license or Policy. Feel free to use it.
Hello Pavithra,
ReplyDeleteI have added the git repository of above code at the of the blog.You can also download it from there and Also I will just going to drop the code on your id .
I GOT THIS ERROR, WHEN I TRY TO RUN THE ZIP FILE.
ReplyDelete08-22 21:39:44.999: E/AndroidRuntime(1799): FATAL EXCEPTION: main
08-22 21:39:44.999: E/AndroidRuntime(1799): java.lang.SecurityException: Permission Denial: opening provider com.android.providers.calendar.CalendarProvider2 from ProcessRecord{413e2d98 1799:com.examples.android.calendar/10085} (pid=1799, uid=10085) requires android.permission.READ_CALENDAR or android.permission.WRITE_CALENDAR
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.os.Parcel.readException(Parcel.java:1327)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.os.Parcel.readException(Parcel.java:1281)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2201)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.app.ActivityThread.acquireProvider(ActivityThread.java:4024)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1629)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.content.ContentResolver.acquireProvider(ContentResolver.java:918)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.content.ContentResolver.query(ContentResolver.java:305)
08-22 21:39:44.999: E/AndroidRuntime(1799): at com.examples.android.calendar.Utility.readCalendarEvent(Utility.java:19)
08-22 21:39:44.999: E/AndroidRuntime(1799): at com.examples.android.calendar.CalendarView$1.run(CalendarView.java:184)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.os.Handler.handleCallback(Handler.java:605)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.os.Handler.dispatchMessage(Handler.java:92)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.os.Looper.loop(Looper.java:137)
08-22 21:39:44.999: E/AndroidRuntime(1799): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-22 21:39:44.999: E/AndroidRuntime(1799): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 21:39:44.999: E/AndroidRuntime(1799): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 21:39:44.999: E/AndroidRuntime(1799): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-22 21:39:44.999: E/AndroidRuntime(1799): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-22 21:39:44.999: E/AndroidRuntime(1799): at dalvik.system.NativeStart.main(Native Method)
Hello Dushyant,
ReplyDeletePlease check the permission in android manifest file.
android.permission.READ_CALENDAR or android.permission.WRITE_CALENDAR
Hi Mukesh,
ReplyDeleteYour code is awesome,I am not able to download the code.Can u send your code i just implement that and made changes accordingly. this is mail id sudheer.412@gmail.com..If u send that will be very useful for me. Thanks in advance..
Did you take the zip file down? The gitHub download link appears to be unavailable.
ReplyDeleteHello friend,I just updated the git repo linked.which was broken....sO please check now.
ReplyDeleteAlso , thanks for sending me email regarding the broken git repo link.
Great basic Calendar! It's a great starting point for me because it's easy to modify.
ReplyDeleteIs it possible to modify this code so that the calendar app synchs with a different Google account other than the one associated with the phone?
ReplyDeleteYes, but for that first of all you have to login with that account via your code using google+ lib and then fetch all the events.
ReplyDeleteI need to add events for the particular date. can
ReplyDeleteu share ur code for the events..
I'm trying to modify your code to gain read only access to a Google Calendar instead of my device's calendar. So in the Utility Class I'm trying to replace ".query(Uri.parse("content://com.android.calendar/events"),..." with "static String calendarURI = "https://www.google.com/calendar/feeds/[another gmail account]@gmail.com/private/full";...
ReplyDelete...
.query(Uri.parse(calendarURI), ..." I think I also need to append a password for authentication. Can you please show me how I can do this?
have you figured this out yet? I am currently working on the exact same problem and am having issues with it.
Deletehello...i downloaded the zip..but it is showing null pointer exception...could you please help me..
ReplyDeletei got the same error.....did u find any solution
DeleteHi,
ReplyDeleteThis calendar starting Sunday.
What should we do to begin Monday.
Thanks.
Hi, I am a relatively new android programmer. I am trying to pull data from a database and incorporate it into the calendar. I am storing the event and time in two different columns. What would be the best way for me to do so?
ReplyDeleteHi,
ReplyDeleteI am a relatively new programmer and am designing an appointment app. I would like to change the events from a database. I currently have the event and the date stored in my database. How would I change the code to make it change from the Uri to a database? Would I only change the Utility.java or what else would I need to change? I would greatly appreciate your help.
Thanks for this post, but i want show event from server using web service then, where i will change in utility class. Help me for this
ReplyDeleteYes.... you have to parse the event and then add that in object or arraylist.
ReplyDeleteHi,
ReplyDeleteThis calendar starting Sunday.
What should we do to begin Monday.
Thanks.
Hi,
ReplyDeleteThis calendar starting Sunday.
What should we do to begin Monday.
Thanks.
hey any body tell me the code
ReplyDeletehow we get selected date in 20 Jan 2013 format....plz reply soon
Hi,
ReplyDeleteI've got a problem with your example.
When i run it on my emulator it works fine, but on my real german android device (xperia arc s) it appears an error (... has unfortunately stoped).
i think it's because i have a German device with a German calender, but i don't know.
I hope you can help me
Mukesh thanks a lot, such an amazing code, but now i need to show List just of calendar Grid to show current month events, how can i do this?
ReplyDeleteHi I have downloaded the zip file.. but event in coming when i tried to run in emulator...
ReplyDeleteHello daniel,
ReplyDeleteTry to run this on device bcoz it fetching events from gmail calender or from your phone calender app.
If there is Calender app on your emulator then first add some event on it.
Hello Mukesh,
ReplyDeleteThanks you so much , its very useful to the beginners. Now i want facebook friends birthday events sync with calendar. what can i do for that. please help me. thanks
Hello Mukesh,
ReplyDeleteThanks you so much. its very useful to beginners. Now i want to sync facebook friends birthday into calendar. how i can do, please give me suggestions. Thanks
Hello Rakhi,
ReplyDeleteUse facebook sdk and first get all calendar event then add those event on the calendar app.
Hello Mukesh,
ReplyDeleteCan you please give me detailed explanation on how to sync with facebook for friends b'day.
Hi Mukesh,
ReplyDeleteIts great. Can u update the code. When I select one day in previous or next month on the calendar then it display the next month calender, It doesn't highlighted the selected day.
Thanks
thanks for sharing Great Work
ReplyDeleteHello Mukesh. Thanks for great tutorial. if you don't mind can you please send me the calendar provider class database. Its very urgent ..thanks in advance
ReplyDeleteHello Sravani,
ReplyDeletecalendar provider class is the in build class. Tell me what exactly you want to do.
As i downloaded your code which is helpful to me.Now i want to add events to calendar those are visible on particular date.so please give me suggestions
ReplyDeleteThe above code is doing the same...check the Utility class there I am using for loop to get all calendar event before that u have to add this code.
ReplyDeleteString eventUriStr = "content://com.android.calendar/events";
ContentValues event = new ContentValues();
// id, We need to choose from our mobile for primary its 1
event.put("calendar_id", 1);
event.put("title", title);
event.put("description", addInfo);
event.put("eventLocation", place);
event.put("eventTimezone", "UTC/GMT +2:00");
// For next 1hr
long endDate = startDate + 1000 * 60 * 60;
event.put("dtstart", startDate);
event.put("dtend", endDate);
//If it is bithday alarm or such kind (which should remind me for whole day) 0 for false, 1 for true
// values.put("allDay", 1);
event.put("eventStatus", status);
event.put("hasAlarm", 1);
Uri eventUri = cr.insert(Uri.parse(eventUriStr), event);
the above code add event into android calender. for more check this link
http://stackoverflow.com/questions/16007549/android-add-event-to-calendar-using-intent-get-eventid
Hi Mukesh,
ReplyDeleteThis is lakshmi...Can u send ur code i just implement that and i ll change as per my requirements.. this is my mail id j.n.v.lakshmi@gmail.com..If u send that ll be very useful for me.please
Hello Lakshmi,
ReplyDeletedownload the complete from git repo
https://github.com/mukesh4u/Android-Calendar-Sync
Hello Mukesh... when i try to run your code it will force close the apps..Pls help
ReplyDeleteHello Isha....
ReplyDeleteAre u running this on emulator....if yes then try to run on real device and then check
Hi Mukesh,
ReplyDeleteThe Calendar is Working great,I need to display only the current week in the gridview.I am hard to find out the problem.Please help me to solve the problem.
hi mukesh, am beginner for the android developer so pls give me a full tutorial like layout , string files also mukesh...
ReplyDeleteHi, in a little number of device the application crash
ReplyDeletejava.lang.NumberFormatException: Invalid long: "null"
at java.lang.Long.invalidLong(Long.java:124)
at java.lang.Long.parseLong(Long.java:341)
at java.lang.Long.parseLong(Long.java:318)
at com.MYPACAGE.Utility.readCalendarEvent(Utility.java:36)
at com.MYPACAGE.CalendarView$1.run(CalendarView.java:198)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I think when there are more the two calendar accounts.
Can You help me?
Hello Mukesh your code not run in my tablet 4.2 it gave me error like
ReplyDelete01-24 15:14:37.497: E/AndroidRuntime(11075): java.lang.NumberFormatException: Invalid long: "null"
01-24 15:14:37.497: E/AndroidRuntime(11075): at java.lang.Long.invalidLong(Long.java:125)
01-24 15:14:37.497: E/AndroidRuntime(11075): at java.lang.Long.parseLong(Long.java:342)
01-24 15:14:37.497: E/AndroidRuntime(11075): at java.lang.Long.parseLong(Long.java:319)
01-24 15:14:37.497: E/AndroidRuntime(11075): at com.examples.android.calendar.Utility.readCalendarEvent(Utility.java:36)
01-24 15:14:37.497: E/AndroidRuntime(11075): at com.examples.android.calendar.CalendarView$1.run(CalendarView.java:184)
01-24 15:14:37.497: E/AndroidRuntime(11075): at android.os.Handler.handleCallback(Handler.java:615)
01-24 15:14:37.497: E/AndroidRuntime(11075): at android.os.Handler.dispatchMessage(Handler.java:92)
01-24 15:14:37.497: E/AndroidRuntime(11075): at android.os.Looper.loop(Looper.java:137)
01-24 15:14:37.497: E/AndroidRuntime(11075): at android.app.ActivityThread.main(ActivityThread.java:4895)
01-24 15:14:37.497: E/AndroidRuntime(11075): at java.lang.reflect.Method.invokeNative(Native Method)
01-24 15:14:37.497: E/AndroidRuntime(11075): at java.lang.reflect.Method.invoke(Method.java:511)
01-24 15:14:37.497: E/AndroidRuntime(11075): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
01-24 15:14:37.497: E/AndroidRuntime(11075): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
01-24 15:14:37.497: E/AndroidRuntime(11075): at dalvik.system.NativeStart.main(Native Method)
At Line endDates.add(getDate(Long.parseLong(cursor.getString(4))));
how can i solve it?
Hi Mukesh,
ReplyDeleteGreat tutorial.
I've been getting an error with endDate. Any idea why this is happening?
01-24 22:58:20.823: E/AndroidRuntime(12538): java.lang.NumberFormatException: Invalid long: "null"
01-24 22:58:20.823: E/AndroidRuntime(12538): at java.lang.Long.invalidLong(Long.java:125)
01-24 22:58:20.823: E/AndroidRuntime(12538): at java.lang.Long.parseLong(Long.java:342)
01-24 22:58:20.823: E/AndroidRuntime(12538): at java.lang.Long.parseLong(Long.java:319)
01-24 22:58:20.823: E/AndroidRuntime(12538): at com.examples.android.calendar.Utility.readCalendarEvent(Utility.java:36)
01-24 22:58:20.823: E/AndroidRuntime(12538): at com.examples.android.calendar.CalendarView$1.run(CalendarView.java:184)
Hi Mukesh ji,
ReplyDeleteThank you so much for your great tutorial on Custom Calendar. It's amazing to see your post and your responsiveness... Hats off... :)
How to display a particular (specific date) in calendar.Is it POSSIBLE?
ReplyDeleteDex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
ReplyDelete[2014-02-10 16:56:13 - CalendarView] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
this will appear when i strat the application
hi please share me the code
ReplyDeleteplease send me the code rahulostwal@gmail.com
ReplyDeleteHi Mukesh in your source code if i set event for current year its not visible in next or previous years of calendar.
ReplyDeletePlease reply as soon as possible its urgent need to implement its my project.
Hi Mukesh,
ReplyDeleteCould you please send me the code at rahulostwal@gmail.com
Hello Rahul,
ReplyDeletedownload the complete code from git repo
https://github.com/mukesh4u/Android-Calendar-Sync
When i run this in emulator, it says unfortunately the calender view has stopped.Please tell me the solution.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi Mukesh Yadav
ReplyDeleteI tried to run you're code in emulator and android phone, but the result is unfortunately stopped. I don't know what seem's to be the problem. Please help
Thank you
Hello Annie,
DeletePlease cross check the calendar permission in
manifest file and try to run this code in real
android phone not on emulator. If still facing
issue then please share me the logcat error
show that I will help you Or If possible drop
me your code...
Hello Mr. Mukesh ....
ReplyDeleteHow can we display YEAR wise Calendar Events
Hello Mukesh,
ReplyDeleteI have a date stored in the SQLite database. How can I highlight that date in this calendar?
Thank you Mukesh
ReplyDeletehi Mukesh and thanks for example . but I have got a problem .
ReplyDelete" ....source not found sdk\platform\android-8\android.jar...."
I hope . you can help me . regards
thank you mukesh, and i have a question, how can i activate the swipe control to get the next month in the calendar?
ReplyDeleteHi, Mukesh, Thanks for your nice code.
ReplyDeleteI found a bug in it because I used many services to generate my events on google calendar and so..
On my smartphone your app crash because found some events without end date.
so.. I have changed piece of code that read events to printout events title and date of events that return null as end date. and also "correct" to go on and enter in your app.
public static ArrayList readCalendarEvent(Context context) {
Cursor cursor = context.getContentResolver().query(
Uri.parse("content://com.android.calendar/events"),
new String[]{"calendar_id", "title", "description", "dtstart", "dtend", "eventLocation"},
null, null, null);
assert cursor != null;
cursor.moveToFirst();
// fetching calendars name
String CNames[] = new String[cursor.getCount()];
// fetching calendars id
nameOfEvent.clear();
startDates.clear();
endDates.clear();
descriptions.clear();
for (int i = 0; i < CNames.length; i++) {
String et = cursor.getString(1);
String ed = cursor.getString(2);
String es = cursor.getString(3);
String ee = cursor.getString(4);
es = getDate(Long.parseLong(es));
if (ee == null) {
Log.d("==readCalendarEvent:EndDate=Null?", "T="+et+" D="+ed+" S="+es );
ee = es;
} else {
ee = getDate(Long.parseLong(ee));
}
nameOfEvent.add(et);
descriptions.add(ed);
startDates.add(es);
endDates.add(ed);
CNames[i] = et;
cursor.moveToNext();
}
return nameOfEvent;
}
I just start to develop on Android so now I don't have good skill to investigate on event Database but I'm very curious to know if in row elements of event there is some info about service that generate event and so the null end date.
How can I get more info about an event?
Thanks, -Fixus971
Hello Mr, Mukesh
ReplyDeleteIt is really Great job.
My question to you Can it is possible???
suppose I am creating one Database table and then Add some events in that table and when I open calendar in my mobile device so that events is automatically bind in calendar view..
I am getting null pointer exception in this project when I run it first time
ReplyDeleteHow to change first day of the week to Monday instead of Sunday?
ReplyDeleteDo you find any answer? I have the same problem... Thanks!
DeleteHi Mr. Mukesh,
ReplyDeleteThankYou for this nice code. I have some some problem with this, this calendar still displays the events even if it is already deleted.
Kindly help me with this please.
Se puede capturar el evento del click en una fecha?
ReplyDeleteHI Mukesh,
ReplyDeleteYour custom calendar is really very awesome. But, I have a task where I should show the calendar starting from present week to next 30 days. Please help me out
Hello Goutham,
ReplyDeleteShare some screen shot of the ui...
Hello Mr, Mukesh
ReplyDeleteIt is really Great job.
My question to you Can it is possible???
suppose I am creating one Database table and then Add some events in that table and when I open calendar in my mobile device so that events is automatically bind in calendar view.. have u sample code then please share
Hello Mayank,
DeleteI don't have any sample code code(via:Database)
Hi Mukesh,
ReplyDeleteWhy the app does not working in KitKat version (4.4)
Yes, It is possible to bind the event from database.You havr to make change in utility class.
ReplyDeletehave you any sample ? then please share
Deleteplease send me sample code
Deletei request you please
Hello Mayank,
DeleteI don't have any sample code code(via:Database)
hey how should i add event in your code
ReplyDeletecan u give exmple
wer shd i add event name description and how to set date
Hello Mukesh, i've modified the code to fetch data from MySQL database and it is working good. The thing is that i need to set the color of the item according to the event. How can i achieve that? In which section of the code i can set the cell color according to the data coming from Utility class? Thanks in Advance
ReplyDeleteHello Douglas, i need sample code please share your sample code.
Deletei want your souce code please send me
DeleteHello Douglas, check the adapter class. You need add few line in it which check your event and based on that event you can apply different cell color.
ReplyDeletehey mukesh, need help please
Deletei want to bind the event from database (sqlite)
why you delete my post ?
DeleteThanks a lot for your reply, the thing is that i'm blocked, i can't figure it out. Pleas help me, =D
DeleteI can change the color of the selected item according of the event but only when is selected, i need to do so on every item when the data is loaded from utility class. I really appreciate the help you can bring me.
DeleteHello Mukesh, thanks for answering and sorry for delay, i have almost a week trying to get it to work and i can't can you give me a hint on this? I would really appreciate it. Thanks!
DeleteHello Mukesh, I really like how your calendar example works. I'm trying to modify it so that it pulls events from my own mySQL database. Can you show me how to modify the code of your Utility class so that the data from a MySQL database can be displayed rather than the on-device calendar database? In my database, I've created the same fields you have: "calendar_id", "title", "description", "dtstart", "dtend","eventLocation". In my AsyncTask, should I bundle this data as HashMap, or ArrayLists or String Arrays? And can you show how to re-write the Utility Class to use this data? Thank you!
ReplyDeletecalendar in andengine
ReplyDeleteHello Mukesh, could you please show me how to re-write the Utility Class using my own ArrayLists (calIdArrayList, calTitleArrayList, calDescrArrayList, calDayStartArrayList, calDayEndArrayList, calLocationArrayList) rather that calling the on-Device calendar database?
ReplyDeleteHi Mukesh,
ReplyDeleteI am creating a simple app to retrieve the events from the calendar. Can you please tell me how to do it? Can it be done using just the Intents?
Thanks a lot.
Thank you :) i found nice calendar code. But, it doesn't work. Error:
ReplyDelete...
com.examples.android.calendar.Utility.readCalendarEvent(Utility.java:54)
...
This code works only on Android versions below 4.0. What i did was to rewrite the utility class to load data from MySQL and the error is gone.
DeleteHi Mukesh,
ReplyDeleteRecurring events are not shown. That means birthday does not shown year to year. 4th june ,2013 birthday event only shown to that day. I cannot see it on next year. Whereas it shown normally on device calender. Can you please fix this issue?
It is a really good Job, but I need to change first day of the week to Monday instead of Sunday, any idea? Thanks!
ReplyDeleteHi Mukesh. Can you send me code on how to only display all the events that we set. the app also should not allow the the user to create event. Help me...
ReplyDeleteGod job,,,thanks for tutorial
ReplyDeleteThanks Ahmad
Deletehi mukesh,
ReplyDeletehow can i add events in this calendar and i want to change these date's backgroud color, please give me answer as soon as possible
can you please m me some ideaz How to develop a hindu Calendar??
ReplyDeletehi mukesh
ReplyDeletehow to add events coming from webservice to your custom calendar??
any idea? then plz share......
Hello Jitu,
DeleteCheck the Utility class there I am binding all the events so modify the code inside Utility class - See more at: http://www.androiddevelopersolutions.com/2013/05/android-calendar-sync.html?showComment=1405837965050#c4887224162025092233
Hello Jitu,
ReplyDeleteCheck the Utility class there I am binding all the events so modify the code inside Utility class
Hello Mukesh,
ReplyDeleteFirst of all thanks for a such great tutorial. Because of your tutorial now i don't need any library project.
My question is this is month view of calendar. So is it possible to create week view using same code?
If yes then please give me some idea.
Thanks Sachin,
DeleteYes , week view is also possible. share me your view then I will give you the proper Idea .
Hello Mukesh,
ReplyDeleteUI is similar to this project only current week will be displayed.
http://i60.tinypic.com/mr946p.png
Next button will display next week and previous will displayed previous week.
Hello Mukesh thanks a lot for this tutorial it's the best in help in LinkedIn I want to handle the reject of permission if the user click cancel to move me to the home Screen and to handle the accept to move me to another activity and thanks a lot
ReplyDeleteHi Mukesh. I ran your program on android emulator version 4.1, it works perfectly, but when i try to run on my phone version 4.4 it crashed, have any idea, please help
ReplyDeletecan you help me how to sync my app with contacts like whats app
ReplyDeleteI'm trying to get this to run on 4.4 as well. What do we need to do to get it to work?
ReplyDeleteReally nice blog . it's save my much time
ReplyDeletehi Mukesh
ReplyDeletei wand to add dynamic event and title (using web service return type is json date ,title ,event etc)
on calender..
plz help
Hi,
ReplyDeleteI'm trying to get this to run on 4.4 but it didn't work.We use code in our project.Can you reload code?
Regards.
Hi,
ReplyDeleteI'm trying to get this to run on 4.4 but it didn't work.We use code in our project.Can you reload code?
Regards.
How to get the calendar full Screen like to default CalendarView in API? Tried the match_parent etc. couldn't stretch to Full screen? Can you help me on this please?
ReplyDeleteHi mukesh will you send me source code. my email id is jaypeemishraec@gmail.com. I want same functionality with dynamic data. please he me.
ReplyDeletePlease check the link at the end , I already shared my code on git
Deleterepository.
Nice mukesh it is work in fragment also
ReplyDeleteHello Mukesh,
ReplyDeleteFirst of all thanks for a such great tutorial.
But i want to select multiple dates on Calendar View. I tried some way but it's not good. Can u help me, please??? (Tutorials, Links, etc)
And my email: javiernguyen1412@gmail.com
Mr Mukesh I am having some problem i am using the custom calendar with sqlite database.That is for reading calendar event i am taking data from database and that database is populated by calling webservice http://www.credila.info/appinterface/credilaJson.php?task=getVisitRange&from=4-12-2015&to=09-12-2015&roi=R1234
ReplyDeleteAt first launch the databse is populated but the data is not shown on calendar.. on second launch it is showing data and count on calendar. I want to show this in first launch. Means the databse is populated and data is shown on calendar in first launch ... plz help me dear
Hello,
DeleteThere is two way to do so, 1. when you are populating data
from database at the same time insert those data into android
default calender so that whenever you are showing your custom calendar view it fetch the event and bind it on the view,which I am doing in my Utility class.
Another way : If you don't want to insert event in android
default calendar then add all events in an arraylist and whenever
you are calling your custom calendar view then compare
calendar date from the arraylist.
hi mukesh r u there?
ReplyDeletehello buddy how would i automatically refresh calendar after adding record in database
ReplyDeleteHello,
Deletewhen you are adding data into database at the same time insert those data into android default calender which I am doing in my Utility class.
Hi,
ReplyDeleteHow to block dates before current date?
dear is this calendar working fine with 2016 year??? because right now this code is not able to call built in method of base adatper that is getItem and getView...
ReplyDeleteplease help me buddy
Hello Deepti,
DeleteYes, Its working fine for Year-2016. In your case might be there is no event added in calendar for Year-2016. Please check.....you can also check it by adding some event manually.
please let me know if still it doesn't worked.
Hello mukesh, Pleas send me a sample code for how can i add event in the calendar. I tried doing it but unable to achieve. Please send a sample code that will help me in showing the events in the calendar.
ReplyDeleteHi mukesh, please help me out in adding events in the calendar code above. I have a list of dates and need an Dot on the calender date (indicating that date has a event). Please send me a sample code as i m finding difficult in achieving this.
ReplyDeletehello,
ReplyDeleteI am getting this error.
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: FATAL EXCEPTION: main
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: Process: com.example.nidhi.hiral_calendar, PID: 24874
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: java.lang.NumberFormatException: Invalid long: "null"
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.invalidLong(Long.java:124)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.parseLong(Long.java:345)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.parseLong(Long.java:321)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.example.nidhi.hiral_calendar.Utility.readCalendarEvent(Utility.java:42)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.example.nidhi.hiral_calendar.CalendarView$4.run(CalendarView.java:187)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5294)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
02-15 13:22:13.749 24874-24886/com.example.nidhi.hiral_calendar W/CursorWrapperInner: Cursor finalized without prior close()
02-15 13:22:15.009 24874-24874/com.example.nidhi.hiral_calendar I/Process: Sending signal. PID: 24874 SIG: 9.
plz help me out.
Thanx
Hello Nidhi..
DeleteAdd null check and check the format...as you are facing the ava.lang.NumberFormatException: Invalid long: "null"
hello
ReplyDeletei am getting this error in my locat.
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: FATAL EXCEPTION: main
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: Process: com.example.nidhi.hiral_calendar, PID: 24874
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: java.lang.NumberFormatException: Invalid long: "null"
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.invalidLong(Long.java:124)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.parseLong(Long.java:345)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.Long.parseLong(Long.java:321)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.example.nidhi.hiral_calendar.Utility.readCalendarEvent(Utility.java:42)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.example.nidhi.hiral_calendar.CalendarView$4.run(CalendarView.java:187)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5294)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
02-15 13:22:08.120 24874-24874/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
02-15 13:22:13.749 24874-24886/com.example.nidhi.hiral_calendar W/CursorWrapperInner: Cursor finalized without prior close()
02-15 13:22:15.009 24874-24874/com.example.nidhi.hiral_calendar I/Process: Sending signal. PID: 24874 SIG: 9.
plz help me out.
Thank u.
Hi Mukesh,
ReplyDeleteReally nice tutorial.Please tell me how do i allow the user to add his own events on a particular date and display the dot as you are doing. plz reply asap.
this codes perfectly works for me in terms of display, but i have encountered some problems in terms of its functionality. these includes:
ReplyDelete* the day and the date are not sync
* the current day is still on April 2
* when i press previous and next button, it will crashed
* it wont display the saved events under the calendar
please help me solve these problems, i need your answers badly :(
you can contact me in my email address - makiutot@gmail.com in case you have an idea to solve my problem. thanks! :D
Hi man. Thank you for you tutorial. I just want to know how can we have a 7*6 calendar instead of 7*5?
ReplyDeleteHi Man. Thank you for your great tutorial. I was wondering how can I have 6*7 calendar instead of 5*7? Thank you so much.
ReplyDeleteHello Mukesh, do you have code to bind the event from database?
ReplyDeleteHi Mukesh, Can u Send me this code. i am doing this calendar but i am not getting this could u pllz help me
ReplyDeletepllz bro
ReplyDelete