My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://kavachai.com
and update your bookmarks.

Thursday, July 30, 2009

Installing & uninstalling applications on emulator

Story 1. Installing application.
To install application to emulator adb utility will be handy:
  • Start emulator.
  • Open command prompt (cmd.exe).
  • Navigate to "tools" directory in Android SDK.
  • Run installation using command "adb install application.apk". For example, "adb install "C:/com.andreware.sample.apk"" when com.andreware.sample.apk is located at root directory on disk C.
  • Wait couple of seconds while application is being installing.

Story 2. Uninstalling application.
There two ways to uninstall application from emulator: uninstall like on real device or use adb utility. First way allows to uninstall any application while adb utility will allow to uninstall only application installed using it (including the ones deployed from IDE).
Let's look at first one first. It is pretty simple and straitforward:
  • Start emulator.
  • On the home screen press the "Menu" button.
  • Choose"Settings" item from menu.
  • Choose "Applications" item in the settings list.
  • Choose "Manage applications".
  • Choose application that you want to uninstall.
  • In the "Application info" window that will appear click "Uninstall" button.
  • Confirm uninstalling.
  • Wait a second while application is being uninstalling and click "OK" on next window that says "Uninstall finished".
Second way requires usage of command line and adb utility:
  • Start enulator.
  • Open command window (cmd.exe).
  • Navigate to "tools" directory in Android SDK.
  • Run remote shell: "adb shell".
  • Goto app directory: "cd /data/app".
  • Now you can list installed applications: "ls".
  • To uninstall application use "rm" command and appropriate apk file. For example, "rm com.andreware.sample.apk".
  • Type "exit" to leave remote shell.

Using Android standard icons in designer

Today I wanted to use standard search icon on one of the buttons. When I want to use custom icon I use Reference Chooser dialog. As a result I have such a reference in a property:
@drawable/search_icon
But Reference Chooser dialog does not provide a way to use standard icon (or I don't see it). Fortunately we can type reference directly to property value either in designer or plane xml. So to use standard drawables "@android:drawable/id" pattern can be used. For example, to set standard search icon I used this reference text:
@android:drawable/ic_menu_search