android: smoothScrollToPosition() not working correctly

I’m trying to smoothly scroll to last element of a list after adding an element to the arrayadapter associated with the listview. The problem is that it just scrolls to a random position arrayadapter.add(item); //DOES NOT WORK CORRECTLY: listview.smoothScrollToPosition(arrayadapter.getCount()-1); //WORKS JUST FINE: listview.setSelection(arrayadapter.getCount()-1); Answer You probably want to tell the ListView to post the scroll … Read more

How to select an item in a ListView programmatically?

I’m trying to select the first item in a ListView programmatically, but it doesn’t appear to have been selected. I am using the following code: if (listView1.Items.Count > 0) listView1.Items[0].Selected = true; Actually I’ve had this problem before but I can’t remember how I managed to solve it! Answer Most likely, the item is being … Read more

manual language selection in an iOS-App (iPhone and iPad)

My question: How can my iPhone-app tell the iOS, that the user did select a language in the apps preferences, that is different from the language set in the general settings? Other formulation of the same question: How can i tell the system, that NSLocalizedString (@”text”, @”comment”); should not access the systemwide selected language, but … Read more

How can I save a text block in visual mode to a file in Vim?

The title is very descriptive. Just in case, I will give an example: START BLOCK1 something END BLOCK1 START BLOCK2 something somenthing… END BLOCK2 I select the BLOCK1 in visual mode I yank it by pressing y How can I save the yanked BLOCK1 to some other file? Answer Select the text you wish to … Read more

JavaScript eyedropper (tell color of pixel under mouse cursor)

I am looking for an “eyedropper” tool, that gives me the hex value of the pixel the mouse cursor is under, in JavaScript for a CMS. For Firefox, there is the excellent ColorZilla extension that does exactly that. However, it’s FF only of course, and I would really like to deliver the tool along with … Read more