I just came across this Android Patterns site. And I love it.
I made a fun game of memory. You have to pair up the cards as quickly as possible. See who can get the fastest score. So far my high score is 60 some seconds.
I went to add a Dialog in a game that I am working on and encountered a BadTokenException. I initially thought that it was related to the library I was using for the game. Then I realized I was using an application context instead of an activity context(which is required for dialogs). For some reason the android documentation has an …
While programming I kept getting dns failed exceptions. The error was called due to not having the proper permission for using the internet in my android manifest. <uses-permission android:name="android.permission.INTERNET" />
I just added sample code showing one method of lazy loading images in a GridView. I used thread, handler, and the looper classes. It starts by displaying a GridView with a ViewSwitcher that initially displays ProgressBars for each image. Then as the images are sequentially loaded the ViewSwitcher switches to the loaded ImageView. Check it out here. Screen shot:
I had used addHeaderView method to add a header to my listview. But when I went to retrieve my adapter I kept getting class cast exceptions. I was very mystified until I looked at my recent changes. I commented out the addheaderview line and viola it worked. A bit of googling directed me to this useful link about the topic.
I came across this while trying to figure out how to make a custom list view layout. So far it works really well. Very simple straight forward example.
I was running into problems where my ListView was not updating after calls to notifyDataSetChanged. Despite the Cursor.isOpen returning true, calls to Cursor.requery were throwing Cursor already closed exceptions. I don’t know why this is but just using changeCursor worked! Additional information.
When making a dialog subclass I came across a problem where OnClickListener events were not firing. The solution I found here worked. It just entailed moving the onclick listener assignments from the normal Oncreate method to the onStart method.
I got this error from the xml layout for a ImageButton. I was using api 3 which apparently does not support this attribute. Simply going to api 4 resolved this problem.