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.
What happened to my layout editor?
There you are, happily creating your layout files in the Eclipse plug-in’s layout editor. Dragging and dropping is a breeze. But then one day, you open a layout XML file and boom! No UI! All you see is the XML tree with all the nodes and attributes. What happened?
What grammar?
My OC side was alarmed when suddenly, my Problems view in Eclipse was filled with warnings on my XML files. Each of my XML files had a warning with it, and that little yellow exclamation mark on the side:
TextView and MaxLines
I have a TextView (who doesn’t?) and I want to adjust its height automatically, depending on the length of the text it will contain. Should be easy. It was, but it took me a couple of minutes to figure it out.
Missing hierarchyviewer in SDK 7
If you have SDK version 7, you are most probably missing the hierarchyviewer
from your /tools
folder. To check your SDK version, launch the SDK manager UI from your installation path, usually C:\android-sdk-windows
, then click About.
More plurals: decimal values
In my previous post, I showed you how to set string plurals. If you noticed, the methods to get the plurals strings only accept int
s. What if (like me) you want to display a decimal value? I am getting my raw value from a progress bar with a range of 1-10, with 0.1 increments.
String Pluralization
Last week, I discovered Android’s support for plural strings by accident. And a good accident it was since I am working on an app that will display a float to the user. I used to display:
Importing existing Android projects to Eclipse
When trying to import an existing Android project to Eclipse, I always encounter the error: The method *XXXXX* must override a superclass method
.