The Android | What is Android | Androids | Android Market | App for Android | Android Apps | Android Application | Download Android | Tablet Android | Tablet PC | Phone Android | Android 2.2 | Android 2.3 | Android Free | Games for Android | Android Samsung | Galaxy Android | Android Google | Games Android | アンドロイド | Android | Android 2 | Android PC | Google Android | Android Galaxy | Phones with Android | Which Android Phone | What is an Android Tablet | What is an Android Phone
Nearby Intersections on GOOG-411
If you're out and about, you can call GOOG-411 and get local information about businesses. Now we've made it even easier to orient yourself without a map in front of you: call GOOG-411, ask for 'details', and in addition to the address and phone number of the business, we'll also point you to the nearest street intersection or adjacent streets.
You can try it now: call 1-800-466-4411, look up 'Google in New York', ask us for more 'details', and we'll tell you that our Chelsea office is 'near the intersection with West 16th Street'. Unless you're a seasoned New Yorker, this might very well save you from walking up or down a few blocks.
The nearby intersections are available for most businesses in the US and Canada. They are derived automatically by an algorithm written on 20% time by Googlers in New York and London. Tell us other ways you would want to use this new feature -- we hope to expand it to other products soon!
Calling all developers for Android Developer Challenge 2!
I'm excited to announce the second Android Developer Challenge (ADC)! The first challenge was a huge success with over 1,700 entries that resulted in 50 excellent winners. With the recent release of Android 1.5, as well as the availability of devices in multiple markets around the world, I'm pleased to announce the second ADC.
We've expanded ADC 2 to involve a very important part of the Android community—the users who will be running these applications. Users of Android-powered devices with Android Market will be able to download a special Android judging application and use it to download and rank applications submitted to the Challenge. The results from this round will determine the top ranking applications in each of the 10 categories. These top applications will then be ranked by a combination of users and a panel of Google selected judges through a similar process as the first round to determine the final winners.
I've already seen a lot of great apps on Android and I look forward to seeing even more innovative and unexpected cool apps that will come out of this Challenge! For more details on ADC 2, please see the official site. Start your engines and good luck!
Android Icon Guidelines
For our second post in our series on Android UI, we're releasing our Icon Design Guidelines and an Android Icon Templates Pack. These should make it a lot easier for you (or your designer) to develop all the icons your applications need, so they fit with the other icons in the Android environment.
The Icon Design Guidelines document describes how to design and export icons that fit within the Android framework. It includes a wealth of detail about icons in the Home screen, menus, the status bar, tabs, dialogs, and lists.
The Android Icon Templates Pack is a collection of template designs, filters, and settings that make it easier for you to create icons that conform to the general specifications given in this Guidelines document. We recommend downloading the template pack archive before you get started with your icon design.
The Templates Pack provides templates in Adobe Photoshop and Adobe Illustrator file formats, which preserves the layers and design treatments we used when creating the standard icons for the Android platform. You can load the template files into any compatible image-editing program, although your ability to work directly with the layers and treatments may vary based on the program you are using.
Lightning talks at Google I/O
Google I/O is approaching, and with over ten quality talks lined up, we should all strive to be attentive, avid learners. But for the last Android session of the conference, we thought it would be fun to unwind and open up the podium for lightning talks. This is where anyone can take the stage for six minutes and talk about anything. If you've done a cool hack involving Android, if you've devised a clever technique for a common problem, or even if you just want to get up on your soapbox for six minutes to appeal to your fellow developers, this is your time to be heard.
For those planning on attending Google I/O, we need you to submit and judge lightning talk proposals through a Google Moderator series we've set up. Please go ahead and start submitting your proposals. You only have 250 characters to describe the talk, which may be 110 more characters than you've been used to these days.
Voting is open from now until the moment the session starts. We'll take the eight highest rated talks and will call upon each speaker to take the stage. Remember you only have six minutes. Exceed that, and our security force tackles you off the stage. Thanks and see you all at I/O!
Google Sync Beta - Now for S60
Google Sync offers two-way, over-the-air contacts and calendar synchronization. This means that you can make changes to your contacts and calendar on your phone or in your desktop Google account. Since Sync uses push technology, the changes should automatically appear within minutes. And your information is constantly syncing, so it's up-to-date and securely stored within your Google account, even if you lose your phone.
Please note: Google Sync for S60 requires Nokia software to be installed on the phone. We also recommend backing up your calendar and contacts before setting up Sync. To find out more about setting up Google Sync on Nokia S60 phones, please visit our help center.
To try Google Sync, visit m.google.com/sync from your desktop.
Posted by Jon Skeet and Douglas Gresham, Software Engineers, Google Mobile
The Iterative Web App - Gmail for Mobile Gets Labels
You asked for it, and we listened. We've added labels to Gmail for mobile on Android-powered devices and the iPhone. Labels in Gmail allow you to use color-coded tags to manage your inbox.
To label an email, select a message then tap 'Label as..." from the drop-down menu on the Floaty Bar. In the pop-up menu, select the label(s) you would like to use and tap 'Apply'. Please note, you can add and remove existing labels to your emails in Gmail for mobile, but labels can only be created, renamed and deleted in the desktop version.
To label your emails on the go, point your mobile browser to gmail.com on your iPhone or Android-powered device. To make it easy to check your Gmail, try creating a home screen link. The new Gmail for mobile supports iPhone/iPod Touch OS 2.2.1 or above, as well as Android-powered devices, and is available for US English only.
Posted by Heaven Kim, Product Marketing Manager, Google Mobile
Google Product Search for Android now with Barcode Scanning
Here's how to get started. First, visit the Google Product Search for mobile homepage by going to Google.com in your browser and selecting 'Shopping' from the 'more' tab. Next, tap on the 'Scan Barcode' button to install the latest version of the Barcode Scanner app -- if you don't already have it -- from Android Market.
After you've installed the application, go back to Product Search in your browser and tap on the 'Scan Barcode' button again. Select "Use by default for this action" and tap on the Barcode Scanner option. After the app opens, center the red line over the barcode and hold the phone steady. When the barcode is read successfully, you'll see a Google Product Search results page back in the browser.
You can also access the scanner directly from the top of the Product Search results page by tapping on the barcode button.
Today, barcode scanning works best for products like electronics, books, movies or video games, but we're working on adding more barcodes for other items. Of course, if your scan does not return a result, you can always type in the product name just as before.
The integration of Barcode Scanner and Product Search for mobile is available in the US and UK, for Android-powered devices.
Posted by Eiji Hirai, Software Engineer, Google Mobile team
Behind the scenes of the NYC - Google mapping partnership
In January New York City Mayor Michael Bloomberg announced a partnership between Google and NYC & Company, NYC’s official marketing, tourism and partnership organization, to create a new website and high-tech information center. Using these new tools, you can now plan a trip to NYC from your home computer, transfer your itinerary to your cell phone, and then learn more at an information center.
A number of people have asked us about our role in the NYC partnership. We did not create nycgo.com and the Official NYC Information Center here at Google, as you'd probably expect. Rather, we provided NYC with our standard APIs and a bit of technical guidance, and NYC did the rest.
To help other cities and organizations gain a bit more insight into how NYC managed to create nycgo.com and the Official NYC Information Center, we put together this short video of interviews with principal members of the NYC project team.
Click here to learn more about the partnership between Google and NYC.
Sky Map for Android - A Mobile Planetarium
Fast forward 12 months. We produced a "prototype" of the mapping application consisting of a phone, a compass, a level, and a map, and then convinced several others to join the project. Now that there was some excitement around the project, the real development could begin.
We were able to play around with a T-Mobile G1 test device in the office and were intrigued by all of the sensors that were available. The GPS and clock allowed us to generate maps for the exact time and location, but the compass and accelerometer were what made Sky Map truly interesting. Using these two sensors, the app can determine the exact direction that your phone is facing and display the stars that are visible. If you want to identify that bright star in the west, all you have to do is point the device in that direction and you'll see "Venus" appear on your screen.
Because we do work for Google, it was perfectly natural for us to add a search feature. We decided to use the location features in the Android platform to implement search in an easy-to-use way. You enter the name of an object of interest, like Saturn, and the phone displays an arrow pointing to the object. As you get closer, the color of the arrow goes from blue to red and the app circles the object when you find it. Voila!
This month is a great opportunity to do some planetary observing -- spot the elusive Mercury in the evening, see Jupiter and Neptune in same binocular field, or view Venus shining in the morning skies. Sky Map was designed to help you navigate the night sky, making months like this particularly exciting! Since 2009 is the International Year of Astronomy, there will be plenty of opportunity to show off the application to your friends.
Download Sky Map from the Android Market, and let us know what you think. We'd love to hear from you, both the good and the bad. You can leave comments here or in the Help Forum.
Posted by Kevin Serafini, Orbiting Software Engineer
YouTube uploads and more now available on Android
- YouTube: record and easily upload videos to YouTube.
- Picasa Web Albums: upload photos directly to your Picasa Web Albums.
- Gmail: multiple-thread selection to easily archive, delete, label or mute several threads at once.
- Search by voice: improved speech recognition.
Posted by Jonathan Matus, Product Marketing Manager, Android Team
Painless threading
Whenever you first start an Android application, a thread called "main" is automatically created. The main thread, also called the UI thread, is very important because it is in charge of dispatching the events to the appropriate widgets and this includes the drawing events. It is also the thread you interact with Android widgets on. For instance, if you touch the a button on screen, the UI thread dispatches the touch event to the widget which in turn sets its pressed state and posts an invalidate request to the event queue. The UI thread dequeues the request and notifies the widget to redraw itself.
This single thread model can yield poor performance in Android applications that do not consider the implications. Since everything happens on a single thread performing long operations, like network access or database queries, on this thread will block the whole user interface. No event can be dispatched, including drawing events, while the long operation is underway. From the user's perspective, the application appears hung. Even worse, if the UI thread is blocked for more than a few seconds (about 5 seconds currently) the user is presented with the infamous "application not responding" (ANR) dialog.
If you want to see how bad this can look, write a simple application with a button that invokes Thread.sleep(2000)
in its OnClickListener. The button will remain in its pressed state for about 2 seconds before going back to its normal state. When this happens, it is very easy for the user to perceive the application as slow.
Now that you know you must avoid lengthy operations on the UI thread, you will probably use extra threads (background or worker threads) to perform these operations, and rightly so. Let's take the example of a click listener downloading an image over the network and displaying it in an ImageView:
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
Bitmap b = loadImageFromNetwork();
mImageView.setImageBitmap(b);
}
}).start();
}
At first, this code seems to be a good solution to your problem, as it does not block the UI thread. Unfortunately, it violates the single thread model: the Android UI toolkit is not thread-safe and must always be manipulated on the UI thread. In this piece of code, the ImageView
is manipulated on a worker thread, which can cause really weird problems. Tracking down and fixing such bugs can be difficult and time-consuming.
Android offers several ways to access the UI thread from other threads. You may already be familiar with some of them but here is a comprehensive list:
Any of these classes and methods could be used to correct our previous code example:
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
final Bitmap b = loadImageFromNetwork();
mImageView.post(new Runnable() {
public void run() {
mImageView.setImageBitmap(b);
}
});
}
}).start();
}
Unfortunately, these classes and methods also tend to make your code more complicated and more difficult to read. It becomes even worse when your implement complex operations that require frequent UI updates. To remedy this problem, Android 1.5 offers a new utility class, called AsyncTask, that simplifies the creation of long-running tasks that need to communicate with the user interface.
AsyncTask is also available for Android 1.0 and 1.1 under the name UserTask. It offers the exact same API and all you have to do is copy its source code in your application.
The goal of AsyncTask
is to take care of thread management for you. Our previous example can easily be rewritten with AsyncTask
:
public void onClick(View v) {
new DownloadImageTask().execute("http://example.com/image.png");
}
private class DownloadImageTask extends AsyncTask{
protected Bitmap doInBackground(String... urls) {
return loadImageFromNetwork(urls[0]);
}
protected void onPostExecute(Bitmap result) {
mImageView.setImageBitmap(result);
}
}
As you can see, AsyncTask
must be used by subclassing it. It is also very important to remember that an AsyncTask
instance has to be created on the UI thread and can be executed only once. You can read the AsyncTask documentation for a full understanding on how to use this class, but here is a quick overview of how it works:
- You can specify the type, using generics, of the parameters, the progress values and the final value of the task
- The method doInBackground() executes automatically on a worker thread
- onPreExecute(), onPostExecute() and onProgressUpdate() are all invoked on the UI thread
- The value returned by doInBackground() is sent to onPostExecute()
- You can call publishProgress() at anytime in doInBackground() to execute onProgressUpdate() on the UI thread
- You can cancel the task at any time, from any thread
In addition to the official documentation, you can read several complex examples in the source code of Shelves (ShelvesActivity.java and AddBookActivity.java) and Photostream (LoginActivity.java, PhotostreamActivity.java and ViewPhotoActivity.java). I highly recommend reading the source code of Shelves to see how to persist tasks across configuration changes and how to cancel them properly when the activity is destroyed.
Regardless of whether or not you use AsyncTask, always remember these two rules about the single thread model: do not block the UI thread and make sure the Android UI toolkit is only accessed on the UI thread. AsyncTask just makes it easier to do both of these things.
If you want to learn more cool techniques, come join us at Google I/O. Members of the Android team will be there to give a series of in-depth technical sessions and answer all your questions.
New BlackBerry Enterprise Server Packages for Google Mobile applications
These enterprise installation packages allow BlackBerry administrators to deploy Google Mobile applications to corporate BlackBerry phones. Administrators have the option of using ALX packages to push applications to BlackBerry phones through BES. Alternatively, administrators can host JAD/COD packages on a private intranet so that employees can download applications from internal sites. BES administrators will need to configure their BlackBerry phones to allow applications from Google to be installed.
The ability to quickly search for information outside of the office is useful to workers on the go. With Google Mobile App, employees can search by voice, or otherwise quickly type queries by selecting query suggestions or past queries in their search history. Users can search for anything they can find on Google, such as stock quotes, product information, or weather. Google Mobile App also enables local search thanks to My Location -- just try searching for "pizza" or "hotel". Google Mobile App conveniently launches Google Maps, where it it is easy to get driving, transit, or walking directions.
If you're a BlackBerry administrator who is interested in deploying Google Mobile applications in your business, learn more at http://mobile.google.com/enterprise
Posted by Ryan Pollock, Product Marketing Manager
Drawable mutations
Android's drawables are extremely useful to easily build applications. A Drawable is a pluggable drawing container that is usually associated with a View. For instance, a BitmapDrawable is used to display images, a ShapeDrawable to draw shapes and gradients, etc. You can even combine them to create complex renderings.
Drawables allow you to easily customize the rendering of the widgets without subclassing them. As a matter of fact, they are so convenient that most of the default Android apps and widgets are built using drawables; there are about 700 drawables used in the core Android framework. Because drawables are used so extensively throughout the system, Android optimizes them when they are loaded from resources. For instance, every time you create a Button, a new drawable is loaded from the framework resources (android.R.drawable.btn_default
). This means all buttons across all the apps use a different drawable instance as their background. However, all these drawables share a common state, called the "constant state." The content of this state varies according to the type of drawable you are using, but it usually contains all the properties that can be defined by a resource. In the case of a button, the constant state contains a bitmap image. This way, all buttons across all applications share the same bitmap, which saves a lot of memory.
The following diagram shows what entities are created when you assign the same image resource as the background of two different views. As you can see, two drawables are created but they both share the same constant state, hence the same bitmap:
This state sharing feature is great to avoid wasting memory but it can cause problems when you try to modify the properties of a drawable. Imagine an application with a list of books. Each book has a star next to its name, totally opaque when the user marks the book as a favorite, and translucent when the book is not a favorite. To achieve this effect, you would probably write the following code in your list adapter's getView()
method:
Book book = ...;
TextView listItem = ...;
listItem.setText(book.getTitle());
Drawable star = context.getResources().getDrawable(R.drawable.star);
if (book.isFavorite()) {
star.setAlpha(255); // opaque
} else {
star.setAlpha(70); // translucent
}
Unfortunately, this piece of code yields a rather strange result, all the drawables have the same opacity:
This result is explained by the constant state. Even though we are getting a new drawable instance for each list item, the constant state remains the same and, in the case of BitmapDrawable, the opacity is part of the constant state. Thus, changing the opacity of one drawable instance changes the opacity of all the other instances. Even worse, working around this issue was not easy with Android 1.0 and 1.1.
Android 1.5 offers a very way to solve this issue with a the new mutate() method. When you invoke this method on a drawable, the constant state of the drawable is duplicated to allow you to change any property without affecting other drawables. Note that bitmaps are still shared, even after mutating a drawable. The diagram below shows what happens when you invoke mutate()
on a drawable:
Let's update our previous piece of code to make use of mutate()
:
Drawable star = context.getResources().getDrawable(R.drawable.star);
if (book.isFavorite()) {
star.mutate().setAlpha(255); // opaque
} else {
star. mutate().setAlpha(70); // translucent
}
For convenience, mutate()
returns the drawable itself, which allows to chain method calls. It does not however create a new drawable instance. With this new piece of code, our application now behaves correctly:
If you want to learn more cool techniques, come join us at Google I/O. Members of the Android team will be there to give a series of in-depth technical sessions and answer all your questions.
Use Google Apps seamlessly with corporate BlackBerry smartphones
Do more with Google Latitude!
- Google public location badge lets you publish your Latitude location on your public website or blog. You can just embed the standard badge -- like this or you can use the KML or JSON feeds directly. Read more about the badge on our Blogger Buzz. When you enable this application, your location will be shared publicly and you will not be able to control who can or cannot see it. For your privacy, you may choose to share your best available location, share only your city-level location, or simply never enable the badge.
- Google Talk location status (beta) lets you share your Latitude location with all your Gmail chat and Google Talk contacts. It will automatically update your status message to your current city as you move, and anyone who can chat with you will be able to see this location status. Of course, you can easily change back to your custom status message at any time.
Please note that we take your privacy very seriously, and your location will not be shared with any application without your consent. Both apps adhere to the same terms and conditions -- you must explicitly opt in to the application and of course, you can always disable an app by going back to the app's page.
These applications are only available in the US for now, but they'll soon be ready for all the same languages and countries that Google Latitude supports.
Hope you enjoy these, and stay tuned for more Latitude goodies. Also, we love feedback, so please tell us what you think in our Help Forum or suggest ideas for apps on our Product Ideas page (be sure to include "Latitude" so we can search for them!).
Posted by Rohan Seth, Software Engineer, Google Mobile