Wednesday, January 19, 2011

Step-by-step developing Android Apps on Nexus One in Windows 7 64-Bit

Most of this is found at http://developer.android.com/sdk/index.html

1. Download the Java JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select the Java button, you don't need the Java EE.
2. Install the Java JDK.

3. Download the SDK (not the installer exe, but the zip file) from the above link. Currently you want the android-sdk_r08-windows.zip file.
4. Unpack the zip file to the location you want to have the SDK installed (doesn't much matter where, just remember where you put it). For example C:\Users\ which will be used here.

5. Add the ANDROID_SWT user variables:
5.1. Open start menu, enter sysdm.cpl into the text field and press enter.
5.2. In the opened window, select Advanced System Settings on the left.
5.3. Select Environment variables in the lower right corner.
5.4. Press the New button under the User variables windows (the top one).
5.5. Enter ANDROID_SWT in the variable name field and the path to the swt 64-bit SWT file into the variable value field. For example C:\Users\<YOUR USERNAME HERE>\android-sdk-windows\tools\lib\x86_64.
5.6. Press OK in all the windows to close them.

6. Download Eclipse from http://www.eclipse.org/downloads/, you want Eclipse IDE for Java Developers for Windows 64 Bit. Unpack the eclipse folder to wherever you want to have eclipse installed. Go into the folder and drag the eclipse.exe file to your desktop or start menu while holding the SHIFT key to make a shortcut to Eclipse.

7. Follow the instructions at http://developer.android.com/sdk/eclipse-adt.html to install the Eclipse ADT Plugin. Here is the list from that page:
7.1. In Eclipse go to Help > Install New Software.....
7.2. Press Add in the top right hand corner.
7.3. write ADT Plugin in the name field and https://dl-ssl.google.com/android/eclipse/ in the Location URL. If you get any errors, try changing from https to http.
7.4. In the Available Software dialog, select the checkbox next to Developer Tools, press Next.
7.5. In the next window, you'll see a list of the tools to be downloaded. Click Next.
7.6. Read and accept the license agreements, then click Finish.
7.7. When the installation completes, restart Eclipse.
7.8. After restaing Eclipse, go to Window > Preferences....
7.9. Select Android from the list on the left.
7.10. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
7.11. Click Apply, then OK.

8. Add the SDK components needed to code for Android (not just the manager which is what you downloaded):
8.1. In Eclipse select Window > Android SDK and AVD Manager.
8.2. Select Available Packages on the left.
8.3. Check the checkbox next to Android Repository to install all versions of the SDK (so you can develop for all versions of Android 1.5 - 2.3).
8.4. Click Install Selected.
8.5. Accept the licenses, press Accept All and then Install.

9. Follow http://developer.android.com/guide/developing/device.html to set up device (Nexus One):
9.1. Connect you Nexus One to the PC using an USB cable.
9.2. When/If Windows says it has failed to install drivers for a device, tell it you have drivers. If windows doesn't ask you for drivers go to the start menu and type devmgmt.msc into the field and press Enter. You will get a list of all your devices, find the one with a red mark and right click it. Select Update Driver Software.
9.3. Select Browse my computer for driver software.
9.4. Select Browse and select the google-usb_driver folder in the SDK folder you unpacked in step 3.

10. Turn on "USB Debugging" on the Nexus One.
10.1. press MENU, select Applications > Development, then enable USB debugging.

11. Try to see if your Nexus One is connected by opening command line (go to start menu, enter cmd and press enter). navigate to the location of your SDK and the platform-tools directory. Run adb devices or just run it directly by using the full path: C:\Users\<YOUR USERNAME HERE>\android-sdk-windows\platform-tools\adb.exe devices. You should see something like:
List of devices attached
HT9DSP500000 device


12. If you already have a project written in Eclipse open the AndroidManifest.xml file, open the Application tab at the bottom and then select true in the Debuggable drop-down box on the left.
12.1. If you do not have a project, follow http://developer.android.com/resources/tutorials/hello-world.html to set one up.

13. To run yourIn Eclipse select Run > Run Configurations...
13.1. Select Android Application on the left and press the New icon.
13.2. Enter whatever you want in the Name field and press browse and select the project you want to run.
13.3. In the target tab. Select Manual.
13.4. Press run. In the dialog select you device and press OK.

Monday, January 10, 2011

"Recent changes" in Android Market

Been frustrated over apps updating, but not telling you about what changes they have done?
Not so big a problem anymore.
A "recent changes" section has been added in the latest release of Android Market, here's how to find it:

- Open the page for an app in Android Market.
- Scroll down to Description
- Click on More and scroll to the end of the section
- Under the title "Recently changed in this version" you'll find the latest changes.

Tuesday, January 4, 2011

TCPDF multipage table page break in multiline cell problem

I had a problem when I was creating PDFs from HTML with TCPDF. Tables spanning multiple pages which contained cells with multiple lines ended up page breaking in the middle of the cells and causing havoc with the automatically generated table header on the next page.

You might have seen other people having this problem:
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468.
And http://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/ created their own class to circumvent the problem.

The fix now is as nicolaasuni says in http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468?message=8669584, get the latest version of TCPDF.

Alternatively, if you can't upgrade, you can use the nobr attribute which tells TCPDF not to break in the middle of a cell or other HTML tag. Usage:
<tr nobr="true">
<td>your content here</td>
</tr>


Solution found (nicolaasuni again): http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3457446?message=7762133