Saturday, November 13, 2010

Getting the alignment right.

As you could see from the previous post, things were not really in place.  I was on that task and I got a good help from the Android Forum.  He had added a "a bottom margin of 62dip" for the RadioGroup and things were much better. 

Incidentally, DIP is "density-independent pixels"  Its an easy way of specifying the size independently of the screen specifics but the OS will keep the widgets in same physical size.

coming back, further to his sugessions, I started modifying and my xml and the current state is like this.

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
  <LinearLayout xmlns:android="" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="10">
          <RadioGroup android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="fill_parent" android:layout_marginBottom="50dip" android:layout_marginTop="5dip" android:layout_marginRight="10dip">
                  <RadioButton android:id="@+id/radioAmount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:tag="Amount" android:layout_weight="1"/>
                  <RadioButton android:id="@+id/radioInt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:tag="Int" android:layout_weight="1"/>
                  <RadioButton android:id="@+id/radioTerm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:tag="Term" android:layout_weight="1"/>
                  <RadioButton android:id="@+id/radioEMI" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:tag="EMI" android:layout_weight="1"/>
          <RelativeLayout xmlns:android="" android:layout_width="wrap_content" android:layout_height="fill_parent">
                    <TextView android:id="@+id/labelAmount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="theAmount" android:textSize="22dip"/>
                    <EditText android:id="@+id/entryAmount" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/labelAmount" android:inputType="numberDecimal" android:layout_marginBottom="5dip" android:textSize="22dip"/>     
                    <TextView android:id="@+id/labelInt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/entryAmount" android:text="The Interest:" android:textSize="20dip"/>
                    <EditText android:id="@+id/entryInt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/labelInt" android:inputType="numberDecimal" android:layout_marginBottom="5dip" android:textSize="22dip"/>
                    <TextView android:id="@+id/labelTerm" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/entryInt" android:text="The Term (months):" android:textSize="20dip"/>
                    <EditText android:id="@+id/entryTerm" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/labelTerm" android:inputType="numberDecimal" android:layout_marginBottom="5dip" android:textSize="22dip"/>
                    <TextView android:id="@+id/labelEMI" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/entryTerm" android:text="theEMI" android:textSize="20dip"/>    
                    <EditText android:id="@+id/entryEMI" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/labelEMI" android:inputType="numberDecimal" android:textSize="20dip"/>
        android:layout_weight="1" android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_gravity="center">
            android:gravity="center_vertical|center_horizontal" android:layout_gravity="center"/>         

The EMI Calculator with the above Layout.

But there was a problem.  If it runs on a smaller screen, either things will be squeezed to fit or some of the items will not be accessible.  So now I am thinking of adding a scrollbar so that (I am expecting) the said problem will not happen.

I got some clue from the following link.

So till I figure something out, bye...

Wednesday, November 10, 2010

First Blood :)

My basic version of the EMI Calculator is ready in running on my HTC as well.  There is a long way to before its anyway near a finished product, I am happy that I have made the first step.

Here is the output on the Emulator.

the EMI Calculator on the Android Emulator
It is intended to calculate any value (specified by the Radio) provided you give the other three. At the moment, I can calculate EMI, Loan amount and Term.  Need find a logic to calculate the Interest.

I also ran this on my mobile and apart from some display issues (like the Radio Buttons are not aligned with the text boxes) this was fine.

At first, I had some issues in running the program on the Mobile.  The driver provided by android was not working.  I was searching for the driver on HTC site.  But then I found that HTC had provided the driver on the SD Card. Thanks HTC.  Once that was installed, everything went very smooth.  I connected the mobile through USB and it detected the device.  I ran the program on Eclipse and it had detected the device and the program ran on the mobile.

Other pending things:
* need to figure out, how I can share it with some one.
* design a Logo.
* Add other features to the tool.

Friday, November 5, 2010


I am excited!

I started exploring Android seriously about a month or so ago.
I then started looking out for a new mobile and my main constraint was "Android 2.1/2.2". My shortlist was HTC Desire, Samsung Galaxy S, HTC Wildfire & Samsung Galaxy 3.  It was a combination of Price & Make.

I was excited, because I thought, for the first time, I have an option of downloading applications and doing a bit of customisation/programing myself.  Ya, iPhone was there.. but I am no fan of Apple!  Its not for the masses :)  [its a war out there b/w iOS of Apple & Android of Google..  The Android side..]

I also started exploring the Android SDK. I did the HelloWorld and started with Dev. Guide.  My first objective is to  build an application to replicate my EMI Calculator.  Lets see.

Meanwhile, I came down to HTC Wildfire.