Resolving “SDK does not have any Build Tools installed” error
After upgrading my Android SDK to 22, I started running into failed builds with the error message:
{android-sdk}/tools/ant/build.xml:479: SDK does not have any Build Tools installed
Couldn’t find very much on the web on how to resolve this and eventually I realized that it was because I only updated existing packages. In SDK 22, the platform tools and build tools are split up into their own items in the SDK manager.
Make sure you install the build-tools and platform-tools.
Bubbling OnClick events
Today, I ran into a problem where I needed to bubble up the OnClick event. Inside of a RelativeLayout, I had a TextView which I had to make clickable (so that it could get some animation) because of this, the OnClickevent got swallowed up. To get around this, in the constructor, I create an OnClickListener which would simply call performClick() from the parent.
Here’s how it goes:
final View parent = this;
mTitleView = (TextView) findViewById(R.id.TitleView);
mTitleView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
parent.performClick();
}
});
Android Lifecycle for two activities
Today, I ran into some problems of not understanding how the lifecycle of two activities. When one activity starts another activity, when does the onPause/Stop/Destroy run in comparison to the onCreate/Start/Resume of the next activity. I put some logging in and here are the results:
ActivityA.onCreate
ActivityA.onStart
ActivityA.onResume
ActivityA.onPause
ActivityB.onCreate
ActivityB.onStart
ActivityB.onResume
ActivityA.onStop
For official docs about this, see: Coordinating Activities
Getting the Model Name of a device in Bada 2.0
Getting the model name of a device in Bada 2.0 doesn’t have anything in the SDK documentation but can be accessed like this:
#include <FSysSystemInfo.h>
String deviceModel;
Osp::System::SystemInfo::GetValue(L”ModelName”, deviceModel);
AppLog(“Model Name %S”, deviceModel.GetPointer());
Also, remember to set the correct privilege in the manifest.xml
<Privilege>
<Name>SYSTEM_SERVICE</Name>
</Privilege>
It’s a bit worrisome that the SystemInfo keys don’t list “ModelName” as a value key. Hopefully there won’t be any breaking changes.
Find Used Memory Slots via Command Line
Yesterday, I was going to order some more ram for my laptop and I didn’t have a screwdriver around to check if the 4gb in my current setup was composed of one 4gb dimm or 2 x 2gb dimm. I found a nifty command-line options (Windows only) to display this information for me.
wmic MEMORYCHIP get banklabel, capacity, caption, devicelocator, partnumber
Welcome
In the last couple months, I’ve made a career shift to get back to what I love: building software. When I was in university, I was very green and I soaked up everything I could. Eventually, I grew a desire to share what I learned and wrote some posts that were read widely across the internet. Years after I wrote the posts, I would have co-workers who would mention to me that they read a post of mine which was helpful to them. As I made my career shift to spend more of my day-to-day getting my hands dirty building software, I thought that it would be good to capture the things I learn and share them again with the world.