Posts

Showing posts from August, 2010

Android Activity.managedQuery selection and selectionArgs arguments

Most of the examples of managedQuery don't use the selection and selectionArgs arguments, others are pretty simple like : Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = " + id, null, DEFAULT_SORT_ORDER); } or Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = ?", new String [] ={id}, DEFAULT_SORT_ORDER); } Both of the above do exacly the same thing. The '?'s are the elements in the array in order they are placed. [ Resource ] I was working on a piece of code that stored IDs in SharedPreferences and then loaded the elements with those IDs into a ListView from a ContentProvider. Basically I was trying to get that : WHERE id IN ( id1, id2, id3, id4,...) So the selection argument looked like that : "id IN ( ? " +  [",? "] + " )" and the selection args stored the ID of elements I wanted to load. SharedPreferences data = getSharedPref

Android Virtual Machine and non-ASCII characters the path

Image
I have found a job ! =) For a month (and hopefully more) I'll be working at Espeo Software. I've started last Wednesday and I've really enjoyed it so far. Currently I'm working on an android app. During its developement I've encountered a bug when trying to launch the AVM on Windows with a profile containing the letter 'Ł'. This is the message I got : ERROR: no search paths found in this AVD's configuration. Weird, the AVD's config.ini file is malformed. Try re-creating it. It appears that while the sdk can be in a folder with such a path that contains non-ASCII character the emulator does not like it. Specifically to .android/avd which on default is stored in your windows user folder. The solution is to add a local user/system variable ANDROID_SDK_HOME with the path to a place you want .android to be. For example ANDROID_SDK_HOME=C:\AndroidDev. You might have to restart your Eclipse or other IDE after doing that. But that fixed it