Pages

Showing posts with label platform. Show all posts
Showing posts with label platform. Show all posts

Monday, 13 June 2011

Android Development Tools ADT and DDMS Version 11 Release

Last week Google released a new version of the Android Development Tools (ADT). If you've not updated to version 11 yet, then DO IT NOW! There are a number of big improvements that will enhance your app development process, particularly regarding layouts and XML editing. Take a look at the video below for details of the update made at Google I/O 2011, if you've been developing on Android for a while, this should really get your juices flowing!



If you're not already then you should be following the Android Developers Blog (or @AndroidDev on Twitter).

How do update my tools in Eclipse?
Make sure you are running Eclipse as Administrator, then go to Help > Check for Updates.
Now just step through the sequence, agree to license terms then restart Eclipse when prompted.

Cannot install Android Development Tools / DDMS

If you see the following error when updating you Android Development Tools and DDMS in Eclipse on a Windows PC, you need to run Eclipse as Administrator.

"The operaton cannot be completed. See the details."

"Cannot complete the install because of a conflicing dependency."

Cannot complete the install because of a conflicing dependency

Tuesday, 17 May 2011

Best Eclipse Shortcuts

There are many sites listing their top Eclipse shortcuts, but for what it's worth I would like to add my most used keyboard shortcuts since starting with Eclipse...

Ctrl + Shift + O = organise and import missing imports
Alt + Shift + R = refactor (rename variable or method)

Ctrl + 1 (one) = Quick fix popup
Ctrl + D = Delete line
Ctrl + O = Outline (easily navigate to parts of project)
Ctrl + M (or double-click tab) = Maximise source when coding
Ctrl + . = Jump next error or warning


Alt + UP / Alt + DOWN = Move selection up or down
Alt + LEFT / Alt + RIGHT = Jump to recently edited sections


Ctrl + Shift + R = open resource (start typing any file name - like indexed search)
Ctrl + Shift + F - Formats code to settings defined under Window > Preferences > Java > Code Style > Formatter

Tuesday, 10 May 2011

First Steps: Android project structure in Eclipse

Android Project structure in Eclipse
This article is a quick guide to the breakdown of the project structure of a typical, simple Android project within Eclipse. The numbered items below refer to the image to the right.
  1. Project root folder (see 7 for details of individual files)
  2. src folder. This is where your java code files are stored.
  3. package folder. This is organised by package name with the java class files within.
  4. Main.java is a java class file, in this case the main activity. Note the exclamation denoting a compilation warning.
  5. Web.java is another java class (without warnings or errors).
  6. gen folder. The generated compiled files when a project is built. You do not need to venture into this folder.
  7. Google APIs folder. The API library folder.
  8. assets folder. This is where you place additional assets for use in your project, such as font (ttf) files.
  9. res folder. This is where the resource files are stored, such as your drawables (images), layouts and string values.
  10. drawable-hdpi folder. High density drawables (images) for use in your project.
  11. drawable-ldpi folder. Low density drawables (images) for use in your project.
  12. drawable-mdpi folder. Medium density drawables (images) for use in your project.
  13. layout folder. This contains the XML layout files that define the screens in your project.
  14. main.xml. This is the layout for the Main activity, defined in Main.java.
  15. web.xml. This is the layout for the Web activity, defined in Web.java.
  16. values folder. This is where your string (text) definitions are stored. To support multiple languages you would find a values folder per language, for example values-fr.
  17. strings.xml. A standard XML file containing named string definitions.
  18. AndroidManifest.xml - The hub of your project containing the details on the Activities, Permissions within your app.
  19. default.properties -An auto-generated configuration file storing the basic project properties.
  20. proguard.cfg - ProGuard can be used to obfuscate your code to prevent nasty code thieves from stealing your secrets. By default this is not applied to the code but the configuration file is still present.
Typically you will place any additional referenced Java libraries (.jar files) into a libs folder.

Hopefully this will help an Android newbie opening up a new project for the first time.

Monday, 18 April 2011

Android Versions

Android Platform Versions, API Levels and Names

Each Android platform release or update is given an incremental API version and also the name of a dessert, to make discussions on the subject easier to swallow (ho ho). The dessert names run in alphabetical order and are always hotly speculated prior to release.

The table below lists the Android versions with their API level and also dessert name. The list strikes-through versions that were not released or are declared obsolete:

Platform Version   API Level    Name
1.01
1.12
1.53Cupcake
1.64Donut
2.05
2.0.16
2.17Eclair
2.28Froyo
2.39Gingerbread
2.3.310Gingerbread
3.011Honeycomb
3.112Honeycomb
3.213Honeycomb
4.014Ice Cream Sandwich
4.015Ice Cream Sandwich
4.113Jelly Bean

It is always worth keeping and eye on the latest Android Platform Versions statistics provided by Google.

How do I find the Android platform version my app is running on?

In your app you can test for the version of Android that is running with the following code:

if(android.os.Build.VERSION.SDK_INT < 8) {
    // Do something for versions less than 2.2
}