Showing posts with label book. Show all posts
Showing posts with label book. Show all posts

Thursday, June 2, 2011

Pre-Order Second Edition of Sam's Teach Yourself Android Application Development in 24 Hours Now!

Our next book, Sam's Teach Yourself Android Application Development in 24 Hours, Second Edition, is available for pre-order from Amazon. Buy it now and be amongst the first to receive it.

We've made extensive changes throughout the entire book, updating it based on feedback from readers -- including many who have commented on this blog -- as well as incorporating updates and changes to the Android SDK and tools. We appreciate all feedback; keep it coming!

We expect this book to hit shelves sometime mid- to late-August. Amazon is showing a date of August 25, while InformIT is showing a date of August 15.

We hope you enjoy it and learn from it.

Friday, March 4, 2011

Reader Feedback: Analysis of an Exercise

At the end of each "Hour" in the Sam's Teach Yourself Android Application Development in 24 Hours book, there are exercises. We originally designed these exercises to be items people could try to extend their knowledge above and beyond what was learned verbatim in the chapter, given some hints and practice using the the Android documentation that is critical to become familiar with.

Here we present one such exercise that occurs in one of the first real coding hours and present our thought process for determining the solution. Hopefully this will help readers who may be struggling with the difficulty of the exercises. That said, we have also determined, based upon reader feedback, that a handful of exercises in the book are perhaps unfairly difficult. For the next edition of the book, many of these will be replaced or labelled as challenge exercises.

Walk-Through of an Exercise

This is from Hour 7 on page 125, if you'd like to follow along. As it's the end of the chapter, you already would have downloaded the code to work along with in the chapter. If not, it's available right here.
"Exercise #1: Modify the LayoutAnimationController in the QuizSplashActivity class to apply animations of each child view within a TableRow control in random order by using the setOrder() method with a value of 2 (random)."
Key Phrase #1: "Modify the LayoutAnimationController in the QuizSplashActivity"

Thought Process, Step 1: This tells me we're dealing with something to do with the LayoutAnimationController. Luckily, we just covered that on page 122, where we gave this following code:

Animation spinin = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
LayoutAnimationController controller = new LayoutAnimationController(spinin);
TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
for (int i = 0; i < table.getChildCount(); i++) {
    TableRow row = (TableRow) table.getChildAt(i);
    row.setLayoutAnimation(controller);
}

Thought Process, Step 2: The code goes in QuizSplashActivity. Since I'm in Hour 7, I've been implementing this activity for the Splash Screen for most of the chapter.

Key Phrase #2: "to apply animations of each child view within a TableRow control"

Thought Process, Step 3: So far so good. The code is already doing that. We found the code in the section labelled, "Animating All Views in a Layout."

Key Phrase #3: "in random order"

Thought Process, Step 4: Hmm, I don't know how to do that. Let me read on, finishing the sentence...

Key Phrase #4: "using the setOrder() method with a value of 2 (random)."

Thought Process, Step 5: Oh, that's how! OK, hold on. I have two options: I could look up this method in the Android SDK docs, or just write it based on what was said in the exercise and see what happens. (Note: We prefer you look it up, like a good student, but experimentation doesn't hurt anything, either.) But perhaps we're lazy so... Let me just add that one line of code to the end of the initial listing, which will now look like:
Animation spinin = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
LayoutAnimationController controller = new LayoutAnimationController(spinin);
TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
for (int i = 0; i < table.getChildCount(); i++) {
    TableRow row = (TableRow) table.getChildAt(i);
    row.setLayoutAnimation(controller);
}
controller.setOrder(2); // THIS IS THE ONE NEW LINE OF CODE, THE SOLUTION TO EXERCISE #1

Run the app and see what happens.... Hey! That's pretty neat. Each time I run it, the animations happen in a different order and sometimes some of them happen at the same time.

Friday, February 11, 2011

Contacts Contract: Intro and Getting Started

If you've been using Android awhile, and have used the Contacts feature at all, you may have noticed that when you push your SDK forward a few versions, many of the calls are now listed as deprecated.

This is because the Android project revamped how the contacts system works in Android 2.0 (API Level 5). The updated system is much more flexible, while also taking a bit more code to use properly. Over at Mobiletuts+, we wrote an article quite a while back that has a quick overview of using the new APIs in context of using the contact picker. Android Essentials: Using the Contact Picker demonstrates how the queries are now often broken up due to increase in the number of internal tables used (or, that's mostly likely the cause).

You can also directly view the open source code for this tutorial.

Tuesday, February 1, 2011

New Feature: Book Code Downloads

Many readers have found it difficult to access the book code downloads from the official publisher site. After some discussion with our editor, we are pleased to inform you that we now have them hosted separately and available for easy, direct download. (No login should be needed and certainly no verification that you own the book. But you already bought it, right? :) )

In addition to providing a new source for downloading the files, we have also provided a single download for all of the code for each book.

The download link is convenient found right next to the Home link above, under "Book Code Downloads."

Happy Android Coding!

Friday, January 28, 2011

Discounted Android Books for Purchase

Android Wireless Application Development (2nd Edition) (Developer's Library)Don't think you'll win a free (signed) copy of Sam's Teach Yourself Android Application Development in 24 Hours from Mobiletuts+? Already have the Sam's book or the first edition of Android Wireless Application Development, but haven't gotten around to buying the second edition?

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 price. :)

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:

Permissions tab from ADT 0.9.7 showing the drop-down list of values
Now looks like:
Permissions tab from ADT 0.9.9, with the corresponding Browse... dialog
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.

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!

Tuesday, August 10, 2010

Reader Feedback: On Log Tags

Sam's Teach Yourself
Android Application Development
in 24 Hours
For the Sam's Teach Yourself Android Application Development in 24 Hours book, we received a question regarding debug tag code in Hours 9 and 10.

Log.d(DEBUG_TAG, "SHARED_PREFERENCES"); 
// (From Hour 10, Page 177)

A couple of readers have asked us: What is DEBUG_TAG? Where is it defined?

The short answer is: you need to define it! By this point in the book, we aren't displaying every line of code you need for the application to compile--only the relevant new code for that particular lesson. We assume that you've mastered certain fundamental Android skills in the previous chapters of the book. One of these skills is understanding the Log calls, such as Log.v or Log.d. which were discussed in detail in Hour 3, Page 54.  This skill is essential for debugging Android applications and is used regularly throughout the book.

Log method calls simply display diagnostic information to the Logcat logging tool, providing the developer with important information as the application executes. These calls have no impact on the actual application functionality. The calls just log string output for debugging purposes. You can include these logging calls in your applications or simply leave them out (and not provide diagnostic logging). If you want to log information using the logging calls, you will need to supply a tag string as the first parameter for each Log method. In Hour 3, we suggest that you define a logging tag for each and every Android project or class you create.

The logging tag is shown in the log output of logcat, so you can tell that the information is coming from your application, Activity, class, or method. It's that simple.
LogCat output showing all device logs. Cluttered.

You can also filter on just the tag, which shows the real power of it.
LogCat, with filter to show only the tag "GestureFunActivity"

So, when you run across a line in the book that uses such a call, we do not provide the definition of DEBUG_TAG variable. Instead, we assume you know that this is a generic logging call, and you should supply the definition of the variable somewhere in your class. For example, if you want to add logging calls to an Activity class called QuizHelpActivity, class, you should add a definition such as:
private static final String DEBUG_TAG = "QuizHelpActivity";
Or maybe you'd prefer:
private static final String DEBUG_TAG = "QuizHelpActivity Logging Info: ";
Or even something for your entire application:
private static final String DEBUG_TAG = "MyAppLogging";
Those of you who have Java experience will likely recognize that the DEBUG_TAG variable is a constant. That is to say, it has the static final qualifiers. Since the input type to the Log functions are String objects, you then know this to be a static final String. Remember that the logging tag should be descriptive for the specific application or class. In fact, it's often set to the class name, but there is no requirement to do so.

We hope this helps clear up this question. As always, feel free to email us or post a comment right here!

Wednesday, March 24, 2010

Korean Translation of Android Wireless Application Development Available


한국어를 아시나요? According to Google Translate, that's something close to "Do you know Korean?"
We ask because our book, Android Wireless Application Development, is now available in Korean!
However, the cover implies that the book supports Android SDK 2.0 (and it is Android 2.0/2.1 compatible for the most part). In fact, it was written to Android SDK 1.5r3, but we are currently working on updating it to Android SDK 2.1 (or later). Stay tuned!
UPDATE: Turns out, what the cover says is that there is a new appendix (not written by us) that talks about updates to 2.0. Interesting!

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."

Sunday, November 1, 2009

Android 2.0 & Droidcon!


It seems like we were justing about Android 1.6. Oh, wait, we were! Well, we have to admit: Android 2.0 is a little underwhelming from the developer point of view. It seems more like Android 1.7. Still, it's great progress and items like the account manager for using multiple accounts across the handset will be great for users and developers alike.

One item we liked, especially since we're on the road this month attending conferences and checking out the Android phones available in Europe, is the built-in update abilities that simply add support for Android 2.0 instead of require a completely new installation and configuration. All we had to do was run the SDK and AVK manager, update to the latest and run the Eclipse updates to get the newest plugin and we were good to go with 2.0!

On code we've tested, we haven't noticed any new issues with 2.0. However, if you run across any issues with our book code, please let us know! Once we've returned from our travels, we'll do a more thorough evaluation--with one of the new Android 2.0 handsets.

We're on the road? That's right! We're just days away from Droidcon in Berlin! See you there!

Thursday, September 3, 2009