Download it now to use with your copy of the book or ebook!
Showing posts with label development. Show all posts
Showing posts with label development. Show all posts
Tuesday, March 27, 2012
Code Downloads for "Android Wireless Application Development Volume I: Android Essentials" Available Here
Download it now to use with your copy of the book or ebook!
Labels:
4.0,
amazon,
android,
android sdk,
book,
code,
development,
ice cream sandwich,
ics,
mobile platform,
published,
publishing,
purchase,
reading,
SDK,
Software,
source code,
teaching,
tutorial
Wednesday, March 2, 2011
Tip: Speeding Up Your Android Emulator Launch
The latest version of the Android emulator comes with a feature called "snapshots." It needs to be enabled as a feature of each AVD. Luckily, this version also includes the ability to edit existing AVDs.
First, enable the feature:
Second, when launching the AVD, choose to load from the snapshot and save the snapshot. When a snapshot isn't found, the AVD boots up from scratch. As we all know, this takes quite a long time even on very fast machines.
Now, when you exit, the system will store off a snapshot of the state of the AVD. This takes a little while, depending on how much RAM is assigned to the AVD. After saving the state once, the AVD will now launch very quickly - usually in just a couple of seconds.
However, the exit is no longer super speedy and often triggers "Not Responding" type messages. If you always want to return to exactly where you left off, this is how it will work. Overall, the behavior is much faster. However, if you want it to come up clean each time, just make sure the first time you boot it's clean, then exit to save the snapshot. Now, when you launch the AVD, only check load from snapshot, but make sure save to snapshot is unchecked.
Now, the system will just load the AVD from the one snapshot you created and not save the state each time you exit. This means super speedy launches into a cleanly booted emulator as well as super speedy exits since the snapshot doesn't have to be saved each time.
You'll start to feel like you don't need to keep the emulators running all the time. You also won't necessarily go looking for a phone each time just to save the emulator boot-up time. (You'll still go after the phone or tablet when debugging for performance or with code bases that are otherwise slow on the emulator or other such reasons.)
How much difference does it actually make? Here are some test results running on a 6 core 3 GHz desktop with 8GB of RAM and a relatively speedy SSD:
That cuts the emulator launch time by 97%. Put another way, the cold launch takes 34 times longer. Taking these steps is well worth the minimal additional effort.
Happy Android Coding!
First, enable the feature:
![]() |
Enabling Snapshots |
Second, when launching the AVD, choose to load from the snapshot and save the snapshot. When a snapshot isn't found, the AVD boots up from scratch. As we all know, this takes quite a long time even on very fast machines.
![]() |
Enable Snapshot options |
Now, when you exit, the system will store off a snapshot of the state of the AVD. This takes a little while, depending on how much RAM is assigned to the AVD. After saving the state once, the AVD will now launch very quickly - usually in just a couple of seconds.
However, the exit is no longer super speedy and often triggers "Not Responding" type messages. If you always want to return to exactly where you left off, this is how it will work. Overall, the behavior is much faster. However, if you want it to come up clean each time, just make sure the first time you boot it's clean, then exit to save the snapshot. Now, when you launch the AVD, only check load from snapshot, but make sure save to snapshot is unchecked.
![]() |
Don't save over old snapshot |
Now, the system will just load the AVD from the one snapshot you created and not save the state each time you exit. This means super speedy launches into a cleanly booted emulator as well as super speedy exits since the snapshot doesn't have to be saved each time.
You'll start to feel like you don't need to keep the emulators running all the time. You also won't necessarily go looking for a phone each time just to save the emulator boot-up time. (You'll still go after the phone or tablet when debugging for performance or with code bases that are otherwise slow on the emulator or other such reasons.)
How much difference does it actually make? Here are some test results running on a 6 core 3 GHz desktop with 8GB of RAM and a relatively speedy SSD:
- Cold launch of Android 3.0 emulator to a usable state: 4 minutes 35 seconds
- Snapshop launch of same Android 3.0 AVD: 8 seconds
That cuts the emulator launch time by 97%. Put another way, the cold launch takes 34 times longer. Taking these steps is well worth the minimal additional effort.
Happy Android Coding!
Labels:
android,
Android Virtual Device,
AVD,
development,
emulator,
snapshot,
tips
Friday, January 28, 2011
Discounted Android Books for Purchase
Well, InformIT is offering up a discount for the second edition of Android Wireless Application Development -- 40% off with the coupon code ANDROID until March 15, 2011. That's a little better than the regular Amazon
Wednesday, January 26, 2011
Honeycomb Preview Now Available
Earlier today, I was just telling someone how we lesser mortals almost never get SDKs much in advance of hardware anymore. Well, we just got one: the Honeycomb SDK preview.
And, besides the preview, the SDK tools and plugins have been updated. Sounds like good stuff. Now to go digest it all for an afternoon snack.
Even if you can't use the new SDK, don't forget to update your tools.
After you've digested it, let us know your favorite new features!
And, besides the preview, the SDK tools and plugins have been updated. Sounds like good stuff. Now to go digest it all for an afternoon snack.
Even if you can't use the new SDK, don't forget to update your tools.
After you've digested it, let us know your favorite new features!
Labels:
android,
android 3.0,
development,
Google,
honeycomb,
preview,
SDK,
tablets
Thursday, October 14, 2010
Reader Feedback: Manifest Permissions Editor
[UPDATE: 13 Feb, 2011: This problem now longer exists in ADT 9.0.0 (the version right after 0.9.9).]
The Android Manifest file editor within Eclipse provides a number of useful editing tabs to wrangle the complexities of this file. One such tab is the Permissions tab. Use the Permissions tab to manage the permissions that your application uses and grants to others.
If you've been working with Android for a while, then you may be familiar with the permissions listed in the drop-down when you register a new permission using the uses-permission tag. We refer to this feature in both our books; specifically in Sam's Teach Yourself Android Application Development in 24 Hours
, Hour 5, "Configuring the Android Manifest File."
Unfortunately, a recent update to the Android Development Tools plugin removed this drop-down. We're not sure if it's a bug or not yet, but the drop-down disappeared in the software update between ADT 0.9.8 or ADT 0.9.9.
What used to look like:
Now looks like:
When you press the Browse... button, the dialog comes up.
The field provided still works for typing in permissions values by hand, instead of selecting them from a list. The alternate method, editing the XML file directly from the last tab, hasn't changed at all.
So where is one to get these values to type in yourself? On page 90 and 91 of the SAMS book, we've listed a number of the most common permission values. However, the best place to get the appropriate values for your applications is from the Android SDK documentation. Permissions are defined in the documentation for the android.Manifest.permission class. Also conveniently listed with these values is a short description of what they enable the application to do. Before including a permission within your application, always check the documentation to determine if that is the most appropriate one to use.
The Android Manifest file editor within Eclipse provides a number of useful editing tabs to wrangle the complexities of this file. One such tab is the Permissions tab. Use the Permissions tab to manage the permissions that your application uses and grants to others.
If you've been working with Android for a while, then you may be familiar with the permissions listed in the drop-down when you register a new permission using the uses-permission tag. We refer to this feature in both our books; specifically in Sam's Teach Yourself Android Application Development in 24 Hours
Unfortunately, a recent update to the Android Development Tools plugin removed this drop-down. We're not sure if it's a bug or not yet, but the drop-down disappeared in the software update between ADT 0.9.8 or ADT 0.9.9.
What used to look like:
![]() |
Permissions tab from ADT 0.9.7 showing the drop-down list of values |
![]() |
Permissions tab from ADT 0.9.9, with the corresponding Browse... dialog |
The field provided still works for typing in permissions values by hand, instead of selecting them from a list. The alternate method, editing the XML file directly from the last tab, hasn't changed at all.
So where is one to get these values to type in yourself? On page 90 and 91 of the SAMS book, we've listed a number of the most common permission values. However, the best place to get the appropriate values for your applications is from the Android SDK documentation. Permissions are defined in the documentation for the android.Manifest.permission class. Also conveniently listed with these values is a short description of what they enable the application to do. Before including a permission within your application, always check the documentation to determine if that is the most appropriate one to use.
Friday, September 17, 2010
Building an Android Application: Book Excerpt
Sometimes publishers allow sites to publish entire chapters of books. ComputerWorld recently published a complete chapter from Sam's Teach Yourself Android Application Development in 24 Hours
. We think this is a particularly good excerpt, too, as it has broad topic coverage.
This excerpt, from Hour 3, covers topics from application design to resources to Android Activities. And then it goes on, and covering Activity lifecycle and even Intents and various things you can do with them as a developer. You even get information about debug logging. It's not just a preview of Hour 3, it's nearly the whole chapter.
Check it out at ComputerWorld!
This excerpt, from Hour 3, covers topics from application design to resources to Android Activities. And then it goes on, and covering Activity lifecycle and even Intents and various things you can do with them as a developer. You even get information about debug logging. It's not just a preview of Hour 3, it's nearly the whole chapter.
Check it out at ComputerWorld!
Tuesday, September 14, 2010
¡Hola! Writing Android Apps for Different Languages and Locales
![]() |
Find out how this screen is localized! |
Resources need not just be strings, either. Learn how to localize and internationalize your strings, colors, images, and more in Android SDK: Building a Localized Phrasebook.
Labels:
android,
code,
development,
internationalization,
language,
locale,
localization,
project risk,
tutorial
Thursday, September 9, 2010
Reader Feedback: Missing Code! Creating Android Widgets
We have moved all of the widget tutorial code to Google Code hosting so it should stick around for longer. The tutorials are still available from developer.com:
Labels:
android,
API,
app widget,
appwidget,
development,
extension,
Home screen,
host,
plugin,
provider,
source control,
widget
Tuesday, September 7, 2010
Android 2.2 Spreading Wide
![]() |
We visited the sculptures after Google IO 2010 |
Recall ten of the most anticipated items us developers were looking for in Top 10 Android 2.2 Features Developers Can't Wait to Use. Anticipated, but have they lived up to the hype? You tell us. Interestingly, Cloud to Device Messaging is still not widely available. And, although it's a user feature, we're definitely seeing that not all carriers are taking the Tethering option as it was developed. The Nexus One could very well be alone in it's implementation.
We took a look at past desserts of Android and compared them to the latest, FroYo (mmm, Frozen Yogurt!), in Android 2.2 and Its Previous Versions: A Sweet Developer Review. Although most of the full API level updates have been fairly minor (especially, for instance, API Level 6 to 7), when you look all the way back to API Level 1, the changes have been substantial. Not only have the APIs changed, but the tools have vastly improved. They started out being surprisingly good for a very young platform. Now they're better than even more mature platforms.
Lastly, we wrote an overview of Android 2.2 for users and developers alike, printed in Linux User & Developer magazine, a UK publication. Hey, Android is available worldwide, mates! This one covers many of the same topics, naturally. (What, did you expect Android 2.2 to change?)
With Android FroYo old news now, what are you most looking forward to in Gingerbread, the next expected release of the SDK (presumably API Level 9)?
Labels:
android,
code name,
cupcake,
developer,
development,
donut,
eclair,
froyo,
gingerbread,
mobile,
mobile platform,
version
Monday, August 16, 2010
Creating Useful AVDs
![]() |
Various Android Virtual Devices |
In some cases, you can just switch to testing on real hardware instead of the emulator. If you have a lot of devices for your team, you can probably just switch to using devices. However, if you can't afford devices for everyone on the development and test team or can't get your hands on some unusual devices with unique hardware characteristics, you can create AVDs to simulate these. Head over to Mobiletuts+ and read our tutorial about creating AVDs that come as close as possible to simulating the following devices:
- HTC Evo 4G
- Google/HTC Nexus One
- Motorola Droid
- T-Mobile/HTC G1
- Archos 5 Internet Tablet
Labels:
android,
Android Virtual Device,
AVD,
development,
Eclipse,
emulator,
mobile platform,
testing
Friday, December 11, 2009
Latest Book Review: Android Wireless Application Development
Thought we'd share with you some comments from our readers. Recently, our youngest and most loyal fan kicked off his future career in mobile software development by "reviewing" our recent software development book, Android Wireless Application Development.
His verdict: Tasty!

"I can also create user interface components at runtime programmatically? Fascinating. Read on!"
"Need my diaper changed. Is there an app for that?"

"I especially enjoyed the bunny pictures!"
"Forget baby sign language, I'm learning Java so I can write killer apps for the Droid phone! I can use royalties I rake in from the Android Market to pay for college... in 18 years."
His verdict: Tasty!

"I can also create user interface components at runtime programmatically? Fascinating. Read on!"
"Need my diaper changed. Is there an app for that?"

"I especially enjoyed the bunny pictures!"
"Forget baby sign language, I'm learning Java so I can write killer apps for the Droid phone! I can use royalties I rake in from the Android Market to pay for college... in 18 years."
Sunday, December 6, 2009
Consumer Confusion or Funny Feature?

Yeah, that's on the Archos device.
I find it funny because I know exactly where that came from. But consumers? They might get confused by this. Ideally, the camera Intent would do something useful to inform the user:
- Provide a warning message that the device doesn't have a camera
- Go directly to the gallery picker instead
Or is this the right behavior so developers can just be lazy and not worry about there being a camera on all devices? And that is the final problem: the device behaves as if it has a camera when it doesn't. It might be convenient for running apps that don't know about the device features, but it actually makes it harder for well written apps.
(P.S. I'm not trying to pick on the Archos device, specifically. It's just the only Android device I have that doesn't have a camera.)
Friday, December 4, 2009
Quick Tip: Eclipse, Source Control, and default.properties

Here's a quick tip for you:
When using Eclipse project properties to change the Project Build Target, make sure the default.properties file is writeable. This may mean checking it out from source control before editing the properties. In our configuration, the Perforce file is not writable and changing the Project Build Target settings with Eclipse does not check out the default.properties file from source control. So, I have to first check it out, then modify the Eclipse settings.

Although default.properties is automatically generated by the Android Tools, the catch is it must also be checked in source control. Usually, this does not trigger an error, either. Instead, the default.properties file will just be out of sync with the settings and possible create strange behavior.
Labels:
android,
coding,
development,
Eclipse,
Software,
source control,
tips
Friday, May 15, 2009
Android Development Tip: Managing AVDs with the Eclipse Android Development Tools Plug-In
I've updated my Eclipse development environment a number of times in the past few weeks, what with the Android 1.5 preview, then the release version. I checked for updates this week and noticed yet another version of the ADT Eclipse plugin was available. One interesting new feature added in the latest version is an Android Virtual Device (AVD) manager, accessible from within Eclipse.

Simply click it and the AVD manager will launch, listing all AVDs on your system. You can Add and Delete AVDs, as well as Refresh the AVD listing.
When creating a new AVD, you can set the following information:

All emulator instances using the Android 1.5 SDK require an AVD configuration. Sure, you can use the android command line interface to create and manage AVDs, but if you just want to create a simple AVD quickly, you can now use the little wizard provided with the ADT plugin. The AVD manager button is added to your Eclipse toolbar. It looks like a little black cell phone.

Simply click it and the AVD manager will launch, listing all AVDs on your system. You can Add and Delete AVDs, as well as Refresh the AVD listing.

- The AVD friendly name
- The Target Android system
- The Skin
- Whether or not to create an SD Card Image
You cannot create custom hardware profiles. That, you still need to use the android command line tool for.
Labels:
1.5 1.5 R1,
android,
Android Virtual Device,
AVD,
development,
Eclipse,
Google,
IDE,
mobile,
SDK,
tips,
tools,
tricks,
wireless
Wednesday, April 22, 2009
Android 1.5: Going Live Within The Next Few Weeks

The much-awaited Android 1.5 SDK update is coming soon to a development environment near you. This update is based on the Cupcake branch of the Android source project and features substantial improvements and additions to the Android APIs, as well as developer tool suite updates and some much-needed UI polish and performance improvements to the overall Android user experience.
You can find a short list of highlights coming in Android 1.5 as part of the Android Developer SDK 1.5 preview on the Android Developer website as well as download the pre-release ("preview") version of Android SDK 1.5 and give it a spin.
You may also find the Cupcake branch roadmap useful.
The SDK 1.5 is expected to be released within the next few weeks. An over-the-air update will likely be sent to Android phones in the field soon thereafter.
What are you looking forward to in this release? We're looking forward to being able to create home screen widgets.
What are you looking forward to in this release? We're looking forward to being able to create home screen widgets.
Subscribe to:
Posts (Atom)