Monday, May 14, 2012

[Android]Google Calendar API change for ICS

Recently I try to create an app which stored event in device calendar, I found this app will crash in Ice Cream Sandwich device. But the same codes in Ginger Bread device will work well. I checked the logcat, and found below logs:

java.lang.IllegalArgumentException: Event values must include an eventTimezone
at com.android.providers.calendar.CalendarProvider2.validateEventData(CalendarProvider2.java:2486)
at com.android.providers.calendar.CalendarProvider2.insertInTransaction(CalendarProvider2.java:2064)
at com.android.providers.calendar.SQLiteContentProvider.insert(SQLiteContentProvider.java:96)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:189)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:152)
at android.os.Binder.execTransact(Binder.java:338)
at dalvik.system.NativeStart.run(Native Method)

Friday, March 23, 2012

[Java] Encode UTF-8 characters to Qrcode by Zxing project

Zxing Project is a famous open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. But I believe there are somebody have the same problem just like me: I can't Encode UTF-8 characters to Qrcode.

Last time I used Google Chart API to solve this problem, finally I find the way out to use the Zxing project that encode UTF-8 characters to Qrcode correctly.

Thursday, March 22, 2012

[Android]OnChildClickListener for ExpandableListView

Last time we talk about how to implement the ExpandableListView widget, this time I'll show you how to implement "OnChildClickListener" for ExpandableListView.

Please follow below codes, and add RED parts to your code, maybe you need to modified some codes.

Wednesday, March 21, 2012

[Android]ExpandableListView for collapse ListView

Although we can see ExpandableListView be implemented in many apps, this is my first time to implement this widget in my app.

device-2012-03-21-181141

ExpandableListView differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.

Friday, March 16, 2012

[Android] Qrcode generate by Google Chart API

Recently I need to encode user information to Qrcode format, I search google and want to find any Qrcode generator library that can be used in my app. I found "Zxing Project"  and "onBarcode.com", those are really useful for me, but those library have a little problem, those can't encode UTF-8 strings to Qrcode, so I find another way out.

Thursday, February 9, 2012

[Android] Get the overall layout of the screen

Use the Configuration.class to get the overall layout of the screen,this is different from using "DisplayMetrics.class" to get the density of the screen.

Tuesday, January 17, 2012

[algorithm]Quick Sort Algorithm

Quick sort is a very fast sort algorithm, which it's used "divide and conquer strategy" to sort the data. On the average and best case, it has O(n log n) time complexity, on worst case, it has O(n^2) time complexity. And it is unstable sorting.