Changing a button’s text color
There are times that when changing a button’s background color, we also want to change the text’s color. There is a method setTextColor(int color)
specifically for this purpose. Seems pretty straightforward enough, but it took me a few tries to get it right the first time I tried using it. Documenting it here so that I wouldn’t forget.
Using CWAC’s EndlessAdapter with a custom adapter
In one of my projects, the app has the potential to display a very, and I mean very, long list. To minimize the loading time of the app, I limit the number of items initially included in the list and then add to it as the user scrolls down.
My EditText is cut off by the on-screen keyboard!
With clients demanding left and right that my app should look like an iPhone app, I tend to be unappreciative of the way Android natively handles UI interactions and such. Notice how the screen automagically scrolls up when you click on an EditText
? It turns out that in iPhone development, the developer does this manually (indicate how much the view should scroll when the on-screen keyboard appears, then scroll it back down afterwards). HA!
Using a custom font in WebView
In one of my projects, I needed to display some special characters that the Android OS by itself cannot seem to render. I figured that I would need to provide a custom font that includes the characters that I needed.
It never ends!
Been ultra super busy the past few weeks. Also learning a lot of new things. And renewing my battle with orientation change, AsyncTasks and dialog boxes.
stealth ninja mode on
Over the past couple of weeks, this blog has been getting unusually high traffic. Which means I get more than one hit per week.
That damn seekbar thumb
If you have ever needed to use a SeekBar
, you definitely would have noticed how hard it is to move the slider (aka thumb) when it is set to the minimum or maximum value. The slider tends to be cut in half, and fitting your finger into it to press it becomes a test of patience.
Enabling/disabling menu items on the fly
In one of my applications, I want to disable some menu entries if the database is not valid or is not present at all. To do that, I make use of the onPrepareOptionsMenu
() API.
Just wondering
You know those postscripts that Google engineers have on their posts in forums? I wonder if they have a sort of “standards body” that came up with it. They all sound like this:
Quick tip: Quick Formatting of Android XML Files
One of the most useful tools in Android’s Eclipse plug-in is the Layout Editor. It is easy to experiment with layouts using the drag-and-drop enabled editor without having to worry about the correct syntax or if you are using the correct attribute name.