Senin, 30 Agustus 2010

Reader Feedback: Trivia Quiz Server Bug

Bugs happen! 

In Hour 17 of Sam's Teach Yourself Android Application Development in 24 Hours, you learn about AsyncTasks. You use one to send a request to the server to add a friend based upon their email address. What's supposed to happen is that the server looks up the email address and if it finds a match, it adds that user to your list of friends, which is stored on the server. Then, when the Scores Screen is updated to download scores of your friends, the server will return XML containing just that. It will not return email address or anything like that -- we don't want privacy leaks.

What was happening?

Nothing!

Nothing? That's right. The server was failing to find any friends -- regardless of the email address. It was, however, returning the correct status. We just didn't bother with doing anything more with the status than printing it out to LogCat. Whoops.

Fixed

The fix was simple. The Google App Engine server has been updated to version 3 and, after some brief testing, we promoted this to the default server.

If you were having trouble with adding friends, now you know why.

This report was sent in by a reader. If you have troubles, please don't hesitate to contact us at androidwirelessdev@gmail.com or right here on this blog. We see all comments. It might just be a bug!

Kamis, 26 Agustus 2010

Reader Feedback: Educational Materials

We're frequently asked by professors, teachers, and other educators about materials they can use in their lectures or coursework above and beyond those found in our books. Our publisher has a great site for this purpose: Pearson Education. They create slides and other teaching materials for the various books, including Android Wireless Application Development and Sam's Teach Yourself Android Application Development in 24 Hours. We don't know exactly when the materials are available, but it is usually some time after the book is available for purchase. If you have any trouble obtaining teaching materials on a particular topic, don't hesitate to contact our publisher, Pearson Education team support or us directly and we will try to accommodate your requests as best we can.

Senin, 23 Agustus 2010

Unit Testing with Android JUnit

Mobiletuts+ Android JUnit Testing Article
Testing is an important part of any software project. Testing for mobile is no different. One way of ensuring correctness of code at all levels is via automated unit testing.  Through automated unit testing, you can define expected results on the normal cases, in addition to edge case failures, standard failures, and everything in between. The popular JUnit framework is often used when writing these unit tests for Java.

The Android framework includes powerful unit testing support. Learn how to get started with Android JUnit with our Mobiletuts+ article on JUnit testing with Android.

Senin, 16 Agustus 2010

Creating Useful AVDs

Various Android Virtual Devices
Many new Android developers just use a basic, default Android Virtual Device (AVD) for development purposes. This is fine when you're just getting started, but when you get serious about designing and developing apps for specific devices, you'll want to give some thought to configuring AVDs to match devices your users actually own.

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

Selasa, 10 Agustus 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!

Rabu, 04 Agustus 2010

Second Edition of Android Wireless Application Development Available as a Rough Cut

Rough Cuts eBook cover
We're current working on the update of our first book, Android Wireless Application Development. We're adding lots of new content, refreshing most content, and adding entirely new chapters.
For those with access to Safari, the Rough Cuts version is available. Right now, that's the first twelve chapters, but the others will be put up not long after we finish them until, finally, the book is shipped in print.
Get Rough Cuts Android Wireless Application Development, Second Edition, now, while it's hot!
ANDROID BOOK © 2008 Template by:
SkinCorner