23 February 2010

Developing Android apps -> the android.jar source #2

edit: this method is outdated. This one works now (16 April 2011).

For some reason, I've had a fight or two with eclipse on getting these sources right. Even after completing the steps I've mentioned in the other blog post.

The steps I'll describe now makes a fake android-src.jar, and fixed it for me tonight. *puh*

(requires you've done everything else I've mentioned)
#ln -s ~/src/android-sources android-src.jar
In eclipse
  • Select your project on the right menu of eclipse
  • Choose Properties
  • Select Android on the left hand list.
  • Choose a different SDK version, 1.6 for example.
  • Click Apply.
  • Wait for building workspace (on the bottom right side of the eclipse window).
  • Choose your correct SDK version again. 1.5 in my example.
  • Click Apply.
Note that the dummy android-src-jar we've made by sym-link needs to be replaced if you're swapping SDK versions.

This is a bit fuzzy and I'm not sure why these sources are causing such grief. There may be better ways of doing this, please tell me if you come across one.


13 February 2010

Android -> SDK provided icons, images and such

Another fairly beginner thing I thought I'd toss out there. I found this out by chance after doing stuff the hard way for a while.

I've spent (aka wasted) time finding my icon this way: changing the icon, launched the app in the emulator, changed the icon, launched the app. Until I finally was pleased with the icon.

... well, like I said, waste of time. The icons are in the open in the SDK in data/res/drawable ex (/opt/android-sdk-linux/platforms/android-1.5/data/res/drawable)


08 February 2010

bit.ly for android

I want to use the url shortening service bit.ly in an android app I'm working on, and was looking for a .jar or something to help me.

Couldn't find anything made for Android which used the httpclient and json -stuff we have bundled with the the Dalvik vm, so I made one myself today and put it on github.

Easiest way is just go grab the BitlyAndroid.java, put it into your source code and start making short URLs. The github project is just a "proof of concept" android junit project.


BitlyAndroid bitly = new BitlyAndroid("bitlyapidemo","R_0da49e0a9118ff35f52f629d2d71bf07");
String shortUrl = bitly.getShortUrl("http://johnsenf.blogspot.com/2009/12/android-sources-and-javadoc-in-eclipse.html");
//shortUrl = "http://bit.ly/9LSEfV"