Category: Android

Here you will learn how to convert a Numer String to different number types.
Each number type in Java has a parse method that allows you convert a string into the primitive type.

When converting a string to a number, the parse method may throw a NumberFormatException if the string is null or an invalid representation for that type.

Ok now why am I showing you this? let’s say you are pulling data from your DB but want to preform calculations on the values, unfortunately the number in the Strings are not ment to be final values and will give you odd numbers for calculations.
Please keep this in mind and take into consideration that an “int” and a “long” will only give you the full number and not the decimal point.

Convert a String to an int

To convert a String to an int, call the static method parseInt() on the Integer class. Below is an example:

String string = "123";
int value = Integer.parseInt(string);

Convert a String to a long
To convert a String to a long, call the static method parseLong() on the Long class. Below is an example:

String string = "123";
long value = Long.parseLong(string);

Convert a String to a float
To convert a String to a float, call the static method parseFloat() on the Float class. Below is an example:

String string = "123.4";
float value = Float.parseFloat(string);


Convert a String to a double
To convert a String to a double, call the static method parseDouble() on the Double class. Below is an example:

String string = "123.4";
double value = Double.parseDouble(string);
Here is an example from my code that shows a quick calculation of some sort
// Convert The060 String to Float for Calculations
float The060f = Float.parseFloat(The060);
int eight = 8;
int ten = 10;
int six = 6;</div>
<div>String TheVerdict = "";</div>

// Do Some Calculations
if (The060f &lt; six) {
TheVerdict = "It's One Amazing Ride!";
} else if (The060f &lt; eight &amp;&amp; The060f &gt; six) {
TheVerdict = "It's One Great Ride!";
} else if (The060f &lt; ten &amp;&amp; The060f &gt; eight) {
TheVerdict = "It's a Decent Ride....";
} else if (The060f &gt; ten) {
TheVerdict = "IT SUCKS!";

// Show AlertDialot with Monkey Thoughts
new AlertDialog.Builder( this )

Ok so after starting with one guide to develop applications for Android I have decided that it was not a good idea….
Why you might ask? well I had to learn much more before I could start posting guides..

So the new project will start in the upcoming days and we will basiclly develop an application that will give y’all the basics.

I’m going to all it Project X – Android Development App

Stay tuned as the app will go on android market as well – free of charge 🙂

Android Market and Android App


Ok what’s burn rate in the project world?
Aside from financing, the term burn rate is also used in project management to determine the rate at which hours (allocated to a project) are being used, to identify when work is going out of scope, or when efficiencies are being lost. Simply put, the burn rate of any project is the rate at which the project budget is being burned (spent).
In earned value management, burn rate is calculated via the formula, 1/CPI, where CPI stands for Cost Performance Index, which is equal to Earned Value / Actual Cost.

Let’s not get into the nitty gritty of project management and calculations but more on what this app has…
Burn Rate based on Budget
Burn Rate based on Project Days
Project Budget Calculator based on CPH, HPD, CPD and Total Project Days

As well you have a list view of all PMP Formulas – Might have missed a few so let me know

Market Linky – Click Me

Our First Useless Application – Hurray!

*** Wait – Quick Update ***
When I started writing this guide it was 2/2/2011 and we are at 2/23/2011, just too much travel and more….
I promise this will not happen again….

*** Wait Again ***
When I started this site I thought it would be simple for someone with basic development skills to write applications and guide other people, now I belive it’s not really the case… am I going to stop? no, not at all, I think you can still pick it up without a problem if you know some and uderstand the basics and if not you will learn as we progress, the only difference is that I don’t this my project here is a two month thing but more like a lifetime few months… now let’s move on

So after our first guide of setting up the project we will start developing on (if you didn’t read that start there – Linky) we are going to create our first useless application.
I’m going to skip the whole Hello World! Hello Android and move on if that’s ok with y’all to something a little less useless.

So what is the most important thing and priceless and most useless thing at the same time in the world?
I’m going to say time…. (correct me if i’m wrong but windows 7 was my idea and bare with me here)
So our first application is going to be a clock 🙂
Now that we have Eclipse open we will start in an odd way but after you learn you can take the lead on how and what.

First thing we are going to do is open our res/values/Strings.xml file

Read More »

So before I start writing our first useless app i’d like to start with the Android Project in Eclipse.
Remember the last guide of Eclipse? if not start here – linky

Open Eclipse
Hit File –> New –> Android Project

Now we will create out project without any activity (screen shot is connected to out next guide with our first application) we will discuss that
Project Name – Straight forward just give it your app name or something that will show up in Eclipse
Build Target – Now this is where you select your minimum android OS version that your application will support, i’m going to go with 1.6 and would not recommend going less then 2.1 as not all devices support 2.2 and up….
Application Name – This is the application name
Package Name – Now if we keep standards here we will use com.inrim.appname where we start with com. then your name or sites name in this case inrim. and then our application name E.G. com.inrim.uselessclock
Un-Check create activity we will get to that some day.
Hit Finish

Now your new project will be created in Eclipse

Let’s break it down on what holds what….
So after we create our project this is what we should get in our project’s root directory:
– AndroidManifest.xml, Main XML files that contains details on our application, components, activities, services and more that are going to be used in the application.
– build.xml, a script for compiling the application and installing it on our AVD or Android Device
–, our property file that is used by our app builder
– src/ folder contains our JAVA source codes
– res/ folder contains our GUI layour, graphics (Icons, Images ETC) and everything will be compiled with out application, please note that you will have three folder for graphics drawable-ldpi, drawable-mdpi, and drawable-hdpi we are not going to use them when we start developing (although it’s something that you will use sometime…)
As we are just starting out in Android development, you can get rid of all three of those directories and create a single drawable directory, putting your image in there.

Now Eclipse does not create all the folders that you might use like
– bin/ contains the application once it is compiled
– libs/ contains third-party Java JARs your application requires
– assets/ contains other files that you want to bundle with your application onto a device

So what no? what happened here?
We have our first project ready, but what can it do? (nothing much but let’s try something)
Right Clock your project –> Expand Run As –> Click Android Appliaction

Your compatible AVD should launch, and…. nothing happens 🙂

So hold on as we are going to dive in very shortly