Saturday, April 21, 2012

Ways to underline text

I just spent the last 15 minutes trying to underline text in my TextView!!!

Here is an interesting article I found that helped me out.

http://stackoverflow.com/questions/8033316/to-draw-an-underline-below-the-textview-in-android/8033336#8033336

Tuesday, March 13, 2012

Scrolling on ListView makes background black

To avoid this problem, set "android:cacheColorHint="@android:color/transparent" on your ListView. E.g.:

<ListView android:id="@+id/main_list_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:cacheColorHint="@android:color/transparent"
    />

Sunday, February 26, 2012

Whew!! Installing your app on a real device!!!

Been trying to install my app on a real device and OMG what a pain that was!! If you read through Google's documentation here, it all sounds really simple. But in reality, it wasn't...at least for me. I'm using an HTC Incredible and here are some problems I ran into:
  1.  The USB connector cable was not doing a good job connecting the phone to my laptop.....loose connection. I spent an hour trying to figure out why the device wasn't showing up in my list of devices while browsing. And then, voila, my husband figured that the device wasn't connected! Got past step 1!
  2. Next, I couldn't find the OEM driver for HTC Incredible on HTC's website!!! I thought it would be easy enough to search for the driver and find it, but nope! Finally I found it here.
  3. Had trouble installing the driver because the device wasn't connected!! :) Went around in circles again trying to install the driver!!!
  4. And the last problem...I feel stupid for this......the device software version was 2.2 and my application was at a min level 2.1 :( and that it why it wasn't getting installed!! jeez!! This is what happens when you try to install my app on a real device for the first time ever....distracted as ever watching the Oscars! :)
All is well that ends well folks!!!

Sunday, February 12, 2012

How to open adb shell

ADB - Android Debug Bridge
Use: Command-line tool to communicate with emulator or a connected Android device. 

Open cmd in folder: <android-sdk>\platform-tools
More info about adb can be found here.

Error in eclipse: error generating final archive....

When I tried to run my Android program this morning I saw an error in eclipse:
Error generating final archive: Debug certificate expired on 2/10/12 10:42 PM!

All android applications need to be signed and the default period is 365 days. This error was caused because of an expired certificate...which means I set up my Android project around this time last year!! :)

Solution:
Navigate to .android folder and delete file: debug.keystore
Go back into your project, clean and rebuild - this will regenerate the file with a new key valid for another 365 days.
You could also generate a key file with custom validity - see this blog post for more info.

After i regenerated the key file, I had errors bringing up the application on my AVD. The error was:
[2012-02-12 14:03:45 - Mayuri] Re-installation failed due to different application signatures.
[2012-02-12 14:03:45 - Mayuri] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2012-02-12 14:03:45 - Mayuri] Please execute 'adb uninstall com.mayuri' in a shell.
[2012-02-12 14:03:45 - Mayuri] Launch canceled!

Apparently the application has to be uninstalled and re-installed after regenerating the key. I tried opening an adb shell to uninstall the application and that did not work. So I ended up deleting and re-creating the AVD. 
The kinds of things you have to do to get your application to run!!