Android AutoConversion EditText component

Juli 8th, 2010 by Gerrit Diesen Artikel diskutieren »

AutoConversion EditText component:

Yesterday i created a Java Swing textfield component that autoconverts a given value into a selectable unit which could be useful.

In the evening i got the idea to port this component to Android and see if it will work there.

Just as a short note…if you are a Java developer you should take a look into Android…it’s sooooo nice, porting the component tooks me not more than 2 hours (and i’m not really into Android development).

Here is the result:

ishot-2.pngishot-3.pngishot-4.png

 

 

 

 

 

 

 

 

 

 

 

So you could type in a value with the unit of your choice and after leaving the field the value will be converted into the EditText „base unit“.

I changed the units with special characters like µ, Å, ² and ³ to u, A, 2 and 3 which leads to units like:

um  <=>  µm

A <=>  Å

m2  <=>  m²

m3  <=>  m³

and so on…

The upper spinner will select the type of unit you would like to use.

The middle spinner will select the current base unit for the textfield.

The lower spinner will adjust the number of decimals for the textfield.

Because it displays the unit directly in the textfield there’s no need for a additional label for the unit.

You also might check this little video

Well again this is nothing very fancy or gui related but it was a nice challange for me so i decided to share it with you… AutoConversionField.zip

 

follow me on twitter if you like…

 

 

Antwort verfassen