My problem was that I was making the call to setContentView() after doing a findViewById(). However, findViewById() can only work if the view is first set. So, call setContentView() before findViewById().
Monthly Archives: January 2012
Android MapView Inflation Error
Adapted from Andrew on stackoverflow.
A strange problem was occurring: the super class of our activity —”MapActivity” — was failing to initialize. Turned out the call to super.onCreate() must happen before the call to setContentView(). MapActivity probably has some setup routines in onCreate() that need to be executed before calling setContentView().
Ref: Explaining –build –host –target
From http://www.linuxquestions.org/questions/slackware-14/explaining-build-host-target-509739/ by gnashley
Ever wondered what specifying build, host and target is all about? In my adventures of creating a compiler for compiling w32 binaries under Linux I ran across these notes which sum up the question better than any other explanation I’ve seen, so I thought I’d pass them along:
some remarks on specifying –host=, –target=and –build=# kindly provided by Keith Marshall:
# 1) build
# this is *always* the platform on which you are running the build
# process; since we are building on Linux, this is unequivocally going to
# specify `linux’, with the canonical form being `i686-pc-linux-gnu’.
#
# 2) host
# this is a tricky one: it specifies the platform on which whatever we
# are building is going to be run; for the cross-compiler itself, that’s
# also `i686-pc-linux-gnu’, but when we get to the stage of building the
# runtime support libraries to go with that cross-compiler, they must
# contain code which will run on the `i686-pc-mingw32′ host, so the `host’
# specification should change to this, for the `runtime’ and `w32api’
# stages of the build.
#
# 3) target
# this is probably the one which causes the most confusion; it is only
# relevant when building a cross-compiler, and it specifies where the code
# which is built by that cross-compiler itself will ultimately run; it
# should not need to be specified at all, for the `runtime’ or `w32api’,
# since these are already targetted to `i686-pc-mingw32′ by a correct
# `host’ specification.
Instant Python Web Server
Go to the directory whose files you want to serve. Run ‘python -m SimpleHTTPServer’. Next, open your browser and enter ‘localhost:8000′ as the URL. If you have an index.html in the directory then that page will be served.
Fix Emacs Slow Start-up on Fedora 16
In my case, emacs was looking for the system’s Fully Qualified Domain Name. I had during setup set the hostname to ‘tpb’. Without a correctly configured DNS server on your network, emacs won’t think this is a FQDN. Easiest fix is to make this an FQDN by including a dot (.) in the name. So I changed my hostname in /etc/sysconfig/network to tpb.localdomain.
Not Too Deep: Why My Wine Tastes Bad
Defining “bad” for everybody is impossible. Too much or too little of the same cause could be responsible, depending on personal taste. I will list out the possible causes I have discovered during my personal quest to understand what I don’t like about my wine.
Too sweet or not: This refers to how “dry” a wine is. A dry wine is one in which most of the sugars in the grape have been converted to alcohol. A drier wine will be less sweet [1]. You may prefer it either way. What’s bad (or good) is entirely up to you.
Too astringent or not: Astringent wines will shrink the skin inside your mouth resulting in a feeling similar to drinking over-steeped tea [5]. This astringent feeling can be attributed to chemical compounds — called tannins — that are found in the skin, stems, leaves, and seeds of grapes [5,10]. The quantity and potency of tannins change how astringent the wine is. Red wines have especially more of these because they are fermented with the grape skins on, unlike white wines which aren’t [5]. You can choose red wine grape varieties that naturally have less potent tannins. For example, merlot or pinot noir [8]. “Breathing” the wine for even a few hours may not have much affect on the astringency as is commonly believed [7,9]. Wine astringency takes days or years in oak casks or bottles to mellow out [9].
Too sour or not: After much reading, I’ve come to understand that sourness occurs mainly due to excessive oxidation [2,3]. More oxygen means more acetaldehyde (from alcohol) and more acetic acid (due to naturally present bacteria in grape) [3], all of which impart green apple and vinegar-like sourness. Higher temperatures exacerbate the problem because they increase the rate of oxidation [2]. Of course, how sour is “too sour” is entirely up to you. Some wines are intentionally made more sour than others [4], but some may have gone bad due to improper storage, or because of errors at the winery. Improper storage is probably more to blame. If the cork dries out, more oxygen will get into the bottle. If its stored accidentally in too warm a place then the increased rate of oxidation will degrade the wine.
Well-breathed or not: This one is mired in controversy, but there are some things that almost everyone I’ve read agrees on [5,6,7,8,9]: breathing allows stinky sulfides and acetic acid vapors to blow off [7]; breathing white wines too much is not desirable because compounds responsible for its fruity aroma escape early, possibly with the sulfides and acetic acid [7]. The controversy I think is with effect of breathing a wine on tannin (see “Too astringent or not” above). My take after much reading is that unless we are talking about wine spending multiple days in a decanter, or years in oak casks undergoing the traditional aging process, our mouths won’t be able to distinguish the change in astringency that comes with “breathing” a wine as we commonly know it [6,7,9].
[1] Wine tasting (Wikipedia)
[2] Temperature and wine aging, Dr. Alexandar Pandell
[3] Oxidation (Wikipedia)
[4] Madeira Wine (Wikipedia)
[5] Tannin in Wine
[6] When breathing matters
[7] Decanting demystified
[8] Tannins, Debra Meiburg
[9] on Decanting
[10] Tannins