I’ve been developing an Android application recently, and I use Android v7 toolbar in my app instead of ActionBar. When I opened some views with EditText, the toolbar stretched and occupied the whole view. It’s really annoyed, because users cannot see anything when they open this view, unless they close the keyboard.
Recently I used below code to implement my app to connect server using HttpsURLConnection, I can connect to the web service with inputted username and password, and get a response back, however I found sometimes the android 2.2 device will throw “org.xml.sax.SAXParseException: Unexpected end of document” error message in logcat.
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)
Although we can see ExpandableListView be implemented in many apps, this is my first time to implement this widget in my app.
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.
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.
今日寫軟體中的某個畫面，我使用了new thread來加速圖片的處理以及使用Progressbar，原本以為應該很快就可以寫好的程式，在測試時卻一直跳出exception：android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
問了孤狗大神才知道原來不能在major thread以外的thread更新使用者介面，所以需先在thread中，download圖片至手機中，download完畢時，sendMessage to Handler，接著在把剛剛download下來的圖片設定至bitmap中，並更新使用者介面才能完成整個流程。