Projecting in Eclipse

Starting with Eclipse, we have to start a new project, which is pretty simple:
File > New > Android Project.
I am calling this project Wedding Logistics, though in places where I feel the need to abbreviate that will be WedLog.

Then I have a decision to make; there are various versions of the Android Operating System out there in the wild. The earlier the version I opt for, the more phones will be able to successfully run my app - but the fewer features I'll be able to use.
This calls for a little research; a quick google gets me this graph from Wikipedia.
The figures are a year out of date, and show 90% of users on Android 2.2 and above. Given that new Android phones are on Ice Cream Sandwich (4.0 and up), working in Android 2.2 is ample.
Now, for Eclipse purposes, we need to translate that version number into an Application Programming Interface (API) number. Android 2.2, aka Froyo, is API 8. This means anyone trying to operate my app on APIs 1-7 is out of luck, but I should be okay for 8 and up.

Next thing I have to do is name the package; this is something for when [eventually] I get this thing onto the App store. Every app needs a unique package name, and to guarantee that, the convention is to use your website url followed by the app name. So for me, that is uk.co.blogger.becomingandroid.weddinglogistics for this app. Ungainly, but it'll do.

Now Eclipse will do its magic - it has created a raft of files that I will need as part of the app, and populated them with bits of generic code. This is part of where an IDE saves hassle. Now, as I mentioned last time, the output from Droid Draw can come straight into Eclipse - specifically, under the folder res (for Resources), layout, main.xml
Now here, I'm following the advice from a tutorial I used; I may need to alter it later, but it will do for now.
I go and have a look at the results in Eclipse, and...ah. Oh dear.
There are two errors; and it doesn't look like it did in Droid Draw. I think the problem is that I used an Absolute Layout - it looked neater. I'll try it with a Relative Layout, remembering that this is meant to be fast-and-dirty!

 Now, calendar appearance aside, that's a bit more like it. Also, there not being any major errors, I can go ahead.
There are however some warnings, highlighting possible problems. On this occasion, they're reminding me that I don't need to hard-code the text (like "Welcome to Wedding Logistics 0.1") - it can go in strings instead. I'm going to ignore that this time, because this text is only appearing on this screen, so I don't see any real advantage to putting it in strings for easy re-use.

You'll also notice that I got rid of the second option for entering the date - firstly, this date-selector looks more like what I had in mind for that, and secondly I have changed the note at the end. This will make the code simpler, though I may return to giving users an approximate option on the front screen later.

So, with the extra faff I had to go through with this, I'll be coming back to the actual code in the src folder next time. There will be import statements!

No comments:

Post a Comment