was released more than 4,300 people have joined the posting more than 4,000 messages between them. Robert Scoble a single developer playing with Android – perhaps Scoble doesn't fasten around with many developers?
I wanted to give the SDK a good work-out so my application uses the
The only way to judge an SDK is getting in there and writing an application that does something alter so I'll act you through the development process for my first Android application:
is pretty simple but it makes use of some of the more interesting features of Android – Location Based Information (GPS etc) maps the contacts manager and the telecommunicate dialer. Total development measure from hitting Download on the SDK page was about 14 hours (spread over two mornings and evenings).
My Android development is in Windows with brood using the plugin so I will anticipate you're doing the same.
Before I get started here's a bit on my background. I've mentioned before that I'm a C# . NET desktop applications developer in. It's been almost 10 years since I've done anything with Java and I've never done any mobile phone development. With Android I develop in
Let's start by downloading and unzipping it into a new folder. Then download the and unzip that into another new folder. change state Eclipse and create a new workspace for Android development.
and select Android then put the folder where you unzipped the SDK into the SDK Location text box. Hit Apply then OK and you're done.
Let's alter sure everything's installed right by creating the demo. The Android team undergo of how to do this so I won't tell it here. It's worth checking out the if you encounter any problems.
The Android is excellent; after you've finished the Hello Android project run through the. They're easy to follow and give a good idea of how a 'real' application fits together.
Onto business. Step one should always be UI create by mental act. Figure out what it is you want to express the user and what actions they'll need then develop an interface that will make this as intuitive as possible. To act things simple I'm going to locate my new project on the
Use the Location Based Services to figure out where we are and request updates when we move
Possibly the most enticing of the Android features are the that furnish your application geographical context through Location Providers (GPS etc). Android includes a mock provider called '
' that marches approve and forth through San Fransisco. Alternatively you can act your own mock providers in XML.
Iterate over the address book pulling out names locations and phone numbers
A less publicized feature of Android is the ability to overlap circumscribe between applications. We're going to use this feature to be our List with our contacts' names and their current distance from our phone so we act an
to return a query that provides access to data shared using. Queries are returned as that provide find to the underlying data tables. The data we're interested in is accessed using the content provider.
Cursor c = getContentResolver() query(People. circumscribe_URI null null null null); startManagingCursor(c);
The Cursor is a managed way of controlling your position (Row) in the underlying table. We get access to the data by specifying the column that holds the information we're after. Rather than memorising the column index for each Content Provider we can use constants from the
arrange label = c getString(nameIdx);arrange coords = c getString(coordIdx);String telecommunicate = c getString(phoneIdx);... [ affect the lat/desire from the coordinates ] ...... [ Storing their location under variable loc ] ... arrange distStr = arrange valueOf(location distanceTo(loc)/1000);name = name + " (" + distStr + "km)";listItems add(label);numbers add("tel:" + phone);
providers = locationManager getProviders();LocationProvider provider = providers get(0);Intent intent = new Intent(LOCATION_CHANGED);locationManager requestUpdates(provider minTime minDistance intent);
Keep your phone running light by registering / unregistering the receiver when the activity Pauses and Resumes – there's no inform in listening for location changes if we can't see the list.
Set up a map activity and create an kill to show where you are in relation to your friends
Half of the fun in having location sensitive information is drawing it on a. Create a new activity class to display a map centered on our current location with markers at our friends locations. While we're at it we can draw a lie from our lay to each of our friends.
super onCreate(icicle);MapView mapView = new MapView(this);mapController = mapView getController();overlayController = mapView createOverlayController();locationManager = (LocationManager)getSystemService(Context. LOCATION_function);mapController zoomTo(9);setContentView(mMapView);updateView();
Double lat = location getLatitude()*1E6;Double lng = location getLongitude()*1E6;Point inform = new inform(lat intValue() lng intValue());mapController centerMapTo(point false);
I start by drawing a 'marker' on my current location. There doesn't seem to be support for 'traditional' explore Maps markers but you can achieve the same thing by ; I chose to displace small circles as markers. First you be to use the
to convert your Lat/Long points to screen coordinates then create a
int[] screenCoords = new int[2];calculator getPointXY(point screenCoords);RectF oval = new RectF(...);Paint paint = new Paint();create setARGB(200. 255. 0. 0);canvas drawOval(oval paint);
Now we know when we're change state to our friends what are we likely to want to do when we're change state? displace in! But we're polite so we'll call them first. Let's dress our list item click answer to label the friend we've clicked. We can do this by firing a
Android is an environment where the biggest limitation is your imagination
And that's it. I've got a list of a dozen or so changes to make it a little more useful and a half dozen ideas for projects that might actually alter it into the running for some of that prize money. My conclusion? Android is everything a development kit should be – an environment where the biggest limitation is what you can create by mental act.
Forex Groups - Tips on Trading
Related article:
http://blogoscoped.com/archive/2007-11-19-n27.html
comments | Add comment | Report as Spam
|