Tuesday, 8 March 2011

Android Developers Blog: The Android 3.0 Fragments API

An important goal for Android 3.0 is to make it easier for developers to write applications that can scale across a variety of screen sizes, beyond the facilities already available in the platform:
  • Since the beginning, Android’s UI framework has been designed around the use of layout managers, allowing UIs to be described in a way that will adjust to the space available. A common example is a ListView whose height changes depending on the size of the screen, which varies a bit between QVGA, HVGA, and WVGA aspect ratios.
  • Android 1.6 introduced a new concept of screen densities, making it easy for apps to scale between different screen resolutions when the screen is about the same physical size. Developers immediately started using this facility when higher-resolution screens were introduced, first on Droid and then on other phones.
  • Android 1.6 also made screen sizes accessible to developers, classifying them into buckets: “small” for QVGA aspect ratios, “normal” for HVGA and WVGA aspect ratios, and “large” for larger screens. Developers can use the resource system to select between different layouts based on the screen size.
The combination of layout managers and resource selection based on screen size goes a long way towards helping developers build scalable UIs for the variety of Android devices we want to enable. As a result, many existing handset applications Just Work under Honeycomb on full-size tablets, without special compatibility modes, with no changes required. However, as we move up into tablet-oriented UIs with 10-inch screens, many applications also benefit from a more radical UI adjustment than resources can easily provide by themselves.

Introducing the Fragment

Android 3.0 further helps applications adjust their interfaces with a new class called Fragment. A Fragment is a self-contained component with its own UI and lifecycle; it can be-reused in different parts of an application’s user interface depending on the desired UI flow for a particular device or screen.
In some ways you can think of a Fragment as a mini-Activity, though it can’t run independently but must be hosted within an actual Activity. In fact the introduction of the Fragment API gave us the opportunity to address many of the pain points we have seen developers hit with Activities, so in Android 3.0 the utility of Fragment extends far beyond just adjusting for different screens:
  • Embedded Activities via ActivityGroup were a nice idea, but have always been difficult to deal with since Activity is designed to be an independent self-contained component instead of closely interacting with other activities. The Fragment API is a much better solution for this, and should be considered as a replacement for embedded activities.
  • Retaining data across Activity instances could be accomplished through Activity.onRetainNonConfigurationInstance(), but this is fairly klunky and non-obvious. Fragment replaces that mechanism by allowing you to retain an entire Fragment instance just by setting a flag.
  • A specialization of Fragment called DialogFragment makes it easy to show a Dialog that is managed as part of the Activity lifecycle. This replaces Activity’s “managed dialog” APIs.
  • Another specialization of Fragment called ListFragment makes it easy to show a list of data. This is similar to the existing ListActivity (with a few more features), but should reduce the common question about how to show a list with some other data.
  • The information about all fragments currently attached to an activity is saved for you by the framework in the activity’s saved instance state and restored for you when it restarts. This can greatly reduce the amount of state save and restore code you need to write yourself.
  • The framework has built-in support for managing a back-stack of Fragment objects, making it easy to provide intra-activity Back button behavior that integrates the existing activity back stack. This state is also saved and restored for you automatically.

Honeycomb APIs power tablet-friendly Android apps

Android 3.0, codenamed Honeycomb, introduces a completely new user interface suitable for tablet devices. Google has also extended the platform's APIs so that third-party developers can make their applications work better on large form factors.
The Android 3.0 SDK preview, which was released last week, offers an early look at some of the new features available to developers. We've been scouring the documentation and looking at the source code examples to see how all the pieces fit together. In this article, we will give you a concise overview of several key new features.

ActionBar

One of the most visible changes in Honeycomb applications is the new ActionBar, which replaces the titlebar at the top of the screen. The ActionBar is responsible for displaying the title, the toolbar buttons for significant actions, and a standard menu button that provides access to additional actions that aren't exposed through toolbar buttons.
It's also possible to use the ActionBar for navigation. It provides methods for adding and removing tabs that look like those used for filtering in the new Android 3.0 application drawer. The reference documentation also describes a "list" navigation mode, where the application title in the ActionBar is replaced with a drop-down menu.
Developers can optionally stuff an arbitrary view into the ActionBar, making it possible to populate it with custom widgets and non-standard elements.

Fragments

Another major new feature in the Android 3.0 SDK is the "fragment" system, which makes user interfaces more modular and simplifies the process of developing applications with multiple panes. Developers can use fragments to define user interface pieces that are combined in layouts within an Activity. The application can control how the fragments are displayed to the user, making it possible to conditionally use different presentations depending on screen size and orientation. This is especially useful for building applications that work on both tablets and smartphones.
The FragmentLayout demo that Google bundles with the SDK is a particularly good example of how this capability can be used. It displays a list of Shakespeare plays and will show a text excerpt from each when it is selected from the list. The list itself and all of the individual excerpts are implemented as fragments. The demo has two separate XML layouts: a single-column layout for portrait orientation that shows only the list, and a multi-column layout for landscape orientation that shows the list on the left and a separate pane on the right for the excerpts.
When the user selects a play from the list, the program will determine how to show the excerpt based on the orientation. If the right-hand pane exists (a condition that occurs only when the landscape XML layout is used), the program will display the desired excerpt fragment in that space. If the pane doesn't exist, then the program will assume that it is being used in portrait orientation and will display the text excerpt in a new activity that replaces the list.
The FragmentManager class can be used to control fragment transactions—operations that manipulate the fragments within an activity, such as hiding and showing fragments or replacing one fragment with another. Android can automatically animate the transitions when such changes occur. Developers can also use the FragmentManager to maintain a stack with the history of fragment transactions.
The transaction history comes in handy if you want the user to be able to roll back through fragment changes by hitting the platform's standard back button. There's also a breadcrumb widget that graphically represents the user's position in the fragment stack history. It can be embedded in the ActionBar for easier navigation through the stack.
A specialized kind of fragment called PreferenceFragment makes it easier for developers to create settings pages for configuring their applications. The PreferenceFragment will automatically bind the state of the preference widgets that it hosts with values in a SharedPreferences instance. It builds on the existing capabilities provided by the PreferenceActivity class. When PreferenceFragments are properly used with a PreferenceActivity, the preferences will automatically be displayed in a two-column view on larger screens.

Drag-and-drop

In order to support richer touch-based interaction with Android applications, Google has added generic drag-and-drop APIs. This feature isn't fully documented yet, but there is an instructive example in Google's API demo code. 
The demo displays large dots on the screen and allows the user to drag them by long-pressing. To trap drag-and-drop events, developers can simply assign a callback with the setOnDragListener method. It will pass in a DragEvent object that can be queried to determine if the drag event is the beginning or end of a drag-and-drop operation.

Conclusion

In addition to these new features, Google has also added richer clipboard APIs, an extensible DRM framework, support for processors with multiple cores, and a new hardware-accelerated rendering framework that will improve the performance of Android's user interface drawing. All of these new capabilities bring value to the platform and will help developers build richer and more sophisticated applications.
We would normally provide links to the code examples described above. Unfortunately, Google hasn't published the Android 3.0 documentation or code samples on the official Android reference website yet, but they can be obtained by downloading the SDK. All of the code examples discussed in this article can be found under the samples/android-Honeycomb/ApiDemos subdirectory.
Honeycomb SDK is still a preview release. The APIs are not yet final and are still subject to change, though we think it's unlikely that there will be major changes between now and when the first Honeycomb devices are launched in February. Applications that take advantage of the new features won't be accepted into the Android Market until Google makes the Android 3.0 release final. For more information, you can refer to the SDK preview page on the Android Developer website.

Monday, 14 February 2011

App: ANDROIDIFY - make android your own

DESCRIPTION

Get ready to make Android your own.
Androidify yourself by customizing the little green Android as yourself, your family, your friends, anyone! Stretch it , shrink it, add a hoody, style its hair, throw on some shades, or even give it a parrot and a pirate hat. Arrrgh!
Once you’ve personalized your Android, share it with your friends, set it as a photo in your contact book, or use it in some inventive way we haven’t thought of yet. Have fun, and we can’t wait to see what you come up with!
Developed together by Google Creative Lab and Larva Labs.

APP SCREENSHOTS



Detail & download:  here

Wednesday, 26 January 2011

Show you the way to change a default application on Android

When you first try an alternative launcher or Web browser, Android asks if you'd like that application to be the default from now on. You may say yes and then come to regret it later on – perhaps you've decided you like another launcher better, or wish to go back to using the stock Android browser.

While you could always uninstall the application you no longer wish to be the default, that's a bit of a brute-force solution. Perhaps you still want it on your system, but only wish to use it every now and then.

To make an app stop being a "default application" for a certain type of action, do this:

1) Go to Settings > Applications > Manage applications.
2) Locate your application in the list. If the list is too long, you can hit the Running tab, because your app most likely is still running somewhere in the background.
3) Once you've located it, tap its name.
4) You will now find yourself in the Application info screen. Scroll down until you see the heading which says Launch by default.
5) Press the Clear defaults button, shown in the screenshot.

When you next try to perform the operation previously associated with this app (launch a browser, go to the home screen, etc.), you will be presented with a dialog letting you choose what app should be used. 

Source: switched

Tuesday, 25 January 2011

British engineers planning to send an Android phone into space

A team of engineers at SSTL and the Surrey Space Centre in Guildford want to see if the sophisticated capabilities in today’s mobile phones can function in the most challenging environment of all: space.
Why are they doing this you might be asking? Shaun Kenyon, the project manager at SSTL, said, “They come now with processors that can go up to 1GHz, and they have loads of flash memory. First of all, we want to see if the phone works up there, and if it does, we want to see if the phone can control a satellite.”
Although the specific phone model to be used hasn’t been announced yet, SSTL wants to use the phone to control a 30cm-long satellite and take pictures of the Earth in the mission later this year. If this works, it could potentially save tons of money and weight for future similar projects in space.
The team chose Android because of its open source software, which means they can tweak it if need be.
“We’re not taking it apart; we’re not gutting it; we’re not taking out the printed circuit boards and re-soldering them into our satellite – we’re flying it as is,” Kenyon explained. ”And, in fact, we’re going to have another camera on the satellite so we can take a picture of the phone because we want to operate the screen and have some good images of that as well.”
All I know is I can’t wait to see pictures of this Android smartphone in space! What device do you think they’ll choose? Let us know in the comments.

Source: BBC

Sunday, 23 January 2011

Review of Sony Ericsson Vivaz 2

Sony Ericsson has had some missteps lately, mostly with not updating their most recent phones beyond version 1.6 of the Android OS. They have some promising phones on the horizon though, with the Xperia Arc leading the pack. Also starting to get a little attention, however, is the MT15i, which is rather like the Vivaz, but sporting the Android the OS. We haven’t heard a lot of talk about this phone, but it’s being positioned to appeal more to the entry-level crowd, rather than those looking for the most powerful phones on the market. It won’t be sporting the Tegra-2 processor, but it also won’t be priced at that level. Based on the review over at mobile-review.com, it may be one of the better choices for those looking for budget-conscious, entry-level Android device.
The MT15i is a more solid offering than some of Sony’s previous phones, having a little more heft, but feeling like a more “quality” device.  The LCD screen is somewhere in the three-inch neighborhood, supporting a 480×854 resolution and their “BRAVIA” technology to improve the overall image quality.  This phone is expected to drop in the UK market somewhere around April, and will be an excellent offering for anyone looking for their first Android phone. No word on whether or now we’ll see it here in the US, but we’ll keep you posted as more details become available.
  
Read this article before making a decision.

WidgetLocker Lets You Customize Your Lock Screen

WidgetLocker, by TeslaCoil Software, is a lock screen replacement app that offers a great deal of extras along with personal customization.  The app assists in preventing you from requiring needless multiple steps to drill down and get back to an apps interface.  You can do it all directly from the lock screen.  The app allows you to place shortcuts and widgets on the lock screen, much like you can on your home screen.  Moving apps around are equally as simple, you just long press and drag to reposition an app or shortcut.  The functionality allows you to stay interactive with certain apps, like music players and podcasts while not accidentally unlocking the phone and touching unwanted applications.  
There are also a plethora of settings that will allow a user to make multiple tweaks to the lock screen, such as the placement of volume keys.  There’s also functionality that will allow you to perform an unlock with the trackball for trackball enabled devices.  In addition, the app also does a wonderful job of providing a tutorial for you to check out all of the features and gives an explanation of each one.  The app also gives you an optional “Easy Wake” feature using any button such as the volume, camera or trackball to wake the device.  Furthermore, the developer has stated that the next version of WidgetLocker will support custom themes.  That should spice up your lock screen a bit.  So if you’re ready for a new lock screen experience, head on over to our apps database and check it out for yourself.  Don’t forget to leave a comment and let us know what you think.

More detail & download: here

Sony Reader app for Android now available

Sony had promised an Android companion app for its eBook store in January 2011, and it's delivered. You can now find Sony Reader in the Android Market, ready to pocket-size your digital tomes previously purchased from the Reader Store.

Like other eBook apps, Sony Reader allows you to adjust the font size and brightness, and supports bookmarking and highlighting. Tap the bottom of the reading window and a slider appears which you can move to skip ahead or back. You can also jump between bookmarks and highlighted passages, and Reader offers a decent built-in search function as well. As an added bonus for owners of a Sony Reader Daily Edition, you can keep your Android device and e-ink reading on the same page, as it were.
An iOS version is also in the works, though Sony's mobile app page says only that it's "coming soon." Sony Reader for Android is a free download and is available now from the Android Market.

Download Sony Reader for Android [AppBrain]

Wednesday, 19 January 2011

The Good News About Android's Version Distribution

When you develop a product and use liberal licensing terms, there's always the risk that someone else will use your code to create a poor product. Maybe it will include a lot of unnecessary features, it will be slow and have a lot of bugs or it will never use the latest version of your software.

Android's goal was to be a common baseline that enables innovation in the mobile space. Convincing other companies to use Android wasn't easy and that's one of the biggest Google accomplishments. Not many people believed in Android's success three years ago and its adoption rate is still surprising.

Convincing companies to update their Android-based firmware faster is much easier. If users only buy Android phones that have the latest version of the operating system and constantly request phone manufacturers and carriers to update the software, then they'll work harder to improve their products.

Google has recently released some information about the current distribution of the Android versions and the good news is that 87.4% of the Android phones use Android 2.x, up from about 55% in July. 51.8% of the phones use Froyo, a version released 7 months ago. In only one month (August 2010), Froyo's share grew from 5.5% to more than 28%, after Motorola and HTC updated phones like Droid, Droid Incredible, Evo 4G, and Desire.



ZDNet says that "almost 13% of Android users are still running versions of the mobile OS that are several generations old and these users will never see Android 2.1", but this percentage is constantly decreasing. Even if they're using Android 1.6, that's still a much better operating system than the one from a feature phone and it still lets them use many apps from the Android Market. A slower update rate is a small price to pay for creating an ecosystem of heterogeneous devices that run the same operating system which is not perfect, but it's "good enough".

Source: googlesystem

Friday, 14 January 2011

How to manage your Android contacts?

How to manage your Android contacts?
Mobile devices have become lifelines for connecting to family, friends, business associates, and clients. With your contacts list growing exponentially, you need to know the best ways to manage this information. Here are some ways Android device owners can keep their contacts list under control.

Google is your friend

The best advice I can offer is to make sure every contact you create on your Android phone is a Google contact. Why is this so important? Because you can manage your Google contacts from within your Google account. This will save you from fumbling around on your mobile phone’s keyboard to try to arrange, categorize, create, edit, and delete those contacts.
If you want the non-Google contacts that are already on your Android phone to be migrated to Google contacts, there is no way to do this directly on the phone; instead, you have to do an export/import. You have to export the contacts to a CSV file to your SD card and then import that file into Google.
To export those contacts, you need to use the free app called UiA - Backup Contacts (it’s available on the Android Market). After you install the app, you’ll see it listed in your Application drawer labeled Backup Contacts. Tap that application, agree to the license, and you’ll see the main window (Figure A), where you can: Backup Now, View Your CSV Contact List, Upload To Dropbox, or Send To Email.
 
Figure A

When you export the contacts using Backup Contacts, that CSV file will be saved on the root of your SD card. The file that is saved to your CSV card will be named Backup.Contacts.TODAYS_DATE.csv; TODAYS_DATE is the date the contacts were saved. With that file on your SD card, you can mount the SD card, copy the file to your PC, and then import that file into your Google account contacts.
This method does not convert the contacts on your phone to Google contacts, so you might find some duplicate entries in your contacts. You can delete the contacts on your phone once you know they’re secured in your Google account.

Groups

Another tip for organizing your contacts is to use groups. Groups allow you to sort, search, and find your contacts much easier.
 
Note: All Google contacts will belong to their own group, “Google.” You cannot reassign those contacts or assign them to multiple groups. You can manage your Google contacts from within your Google account, but you will not be able to see those actions (such as adding Google contacts to groups within Google) on your Android phone.
For contacts that are on your phone, you can create groups by following these steps:
1. Open the Contacts application.
2. Tap the Groups tab (Figure B).
3. Tap the Menu button.
4. Tap the Create button.
5. Create your new group.
 
Figure B

The Groups tab also includes all social media accounts you have authenticated on your phone. Follow these steps to assign a contact to a group:
1. Tap the Groups tab.
2. Tap the Add Member button.
3. Select all contacts you want to join the group.
4. Tap the Add button.

Linked Contacts

A very nice feature of the Android contact system is Linked Contacts. A Linked Contact is a way to link one contact to a related contact. For instance, you might want to link all the employees of a specific department. To do this, open one of those contacts and scroll down to the bottom. Tap the section labeled Linked Contacts (Figure C) and then tap the Add Link Contact button. On the next screen, find the contact you want to link, and it will be linked. Repeat these steps to link more contacts. You are limited to five linked contacts.
 
Figure C

Samsung Captivate-specific tips

The next two features I’ll highlight — Directional Swiping and Speed Dialing — are unique to the Samsung Captivate line of phones.
 
Directional Swiping
From your Contacts application, the Directional Swiping feature allows you to quickly phone or message a contact depending upon which way you swipe that contact. If you swipe the target contact to the right, you place a phone call; if you swipe the target contact to the left, you send an SMS message. This feature is incredibly handy and should be made available to all Android phones.
 
Speed Dialing
To add a contact to speed dialing, follow these steps:
1. Open the Contacts application.
2. Tap the Menu button.
3. Tap the Speed Dial button.
4. Tap the number for which you want to add a contact.
5. Find and select the contact.

Learn Java for Android Development

Product Description

Android development is hot, and many programmers are interested in joining the fun. However, because this technology is based on Java, you should first obtain a solid grasp of the Java language and its foundational APIs to improve your chances of succeeding as an Android app developer. After all, you will be busy learning the architecture of an Android app, the various Android-specific APIs, and Android-specific tools. If you do not already know Java fundamentals, you will probably end up with a massive headache from also having to quickly cram those fundamentals into your knowledge base.

Learn Java for Android Development teaches programmers of any skill level the essential Java language and foundational Java API skills that must be learned to improve the programmer’s chances of succeeding as an Android app developer. Each of the book’s 10 chapters provides an exercise section that gives you the opportunity to reinforce your understanding of the chapter’s material. Answers to the book’s more than 300 exercises are provided in an appendix. Once you complete this book, you will be ready to dive into Android, and you can start that journey by obtaining a copy of Beginning Android 2.

Additionally, author Jeff Friesen will provide supplementary material (such as 6 more chapters) on his javajeff.mb.ca website, available over the next few months following this book's release.

What you’ll learn

    * The Java language: This book provides complete coverage of nearly every pre-Java version 7 language feature (native methods are briefly mentioned but not formally covered). Starting with those features related to classes and objects, you progress to object-oriented features related to inheritance, polymorphism, and interfaces. You then explore the advanced language features for nested types, packages, static imports, exceptions, assertions, annotations, generics, and enums. Continuing, you investigate strictfp, class literals, synchronized, volatile, the enhanced for loop statement, autoboxing/unboxing, and transient fields. The book also briefly presents most (if not all) of Java version 7’s language features, although not much is said about closures or modules (which were not finalized at the time of writing).
    * Java APIs: In addition to Object and APIs related to exceptions, you explore Math, StrictMath, BigDecimal, BigInteger, Package, Boolean, Character, Byte, Short, Integer, Long, Float, Double, Number, the References API, the Reflection API, String, StringBuffer, System, the Threading API, the collections framework, the concurrency utilities, the internationalization APIs, the Preferences API, Random, the Regular Expressions API, File, RandomAccessFile, stream classes, and writer/reader classes. You will also get a tiny taste of Swing in the context of internationalization.
    * Tools: You will learn how to use the JDK’s javac (compiler), java (application launcher), javadoc (Java documentation generator), and jar (Java archive creator, updater, and extractor) tools. You will also receive an introduction to the NetBeans and Eclipse integrated development environments. Although you can develop Android apps without NetBeans or Eclipse, working with these IDEs is much more pleasant.

Who this book is for

This book is for any programmer (including existing Java programmers and Objective-C (iPhone/iPad) programmers) of any skill level who needs to obtain a solid understanding of the Java language and foundational Java APIs before jumping into Android app development.

Table of Contents

   1. Getting Started with Java
   2. Learning Language Fundamentals
   3. Learning Object-Oriented Language Features
   4. Mastering Advanced Language Features Part 1
   5. Mastering Advanced Language Features Part 2
   6. Exploring the Basic APIs Part 1
   7. Exploring the Basic APIs Part 2
   8. Discovering the Collections Framework
   9. Discovering Additional Utility APIs
  10. Performing I/O
  11. Solutions to Exercises

About the Author

Jeff ""JavaJeff"" Friesen is a freelance software developer and educator specializing in Java and now Android technology. In addition to teaching Java at a local college, he's written several books on Java, with Learn Java for Android and Beginning Java SE 6 Platform: From Novice to Professional being his most recent books. Jeff has also written numerous articles for java.net, InformIT.com and JavaWorld.com. Check out his javajeff.mb.ca website to discover these articles, as well as additional material on Java, JavaFX, and other software technologies.

Source: Android-er blog
Learn Java for Android Development on Amazon.com

This book is also available:  http://books.google.com/books?id=dWC1zHcr4HcC

Friday, 31 December 2010

App: NhacCuaTui - An application helps you listen to music anytime - anywhere

Screenshot: 
Descriptions:

This is the official mobile application of website nhaccuatui.com, developed by NCT Corporation Mobile Lab. Now you can have access to your favourite music anywhere and anytime that you want. NCT Mobile App will update the hottest songs and playlists automatically, let's try and enjoy the world of music on your device.

Version:  1.0 (for all Android versions)

Download:  Here

Wednesday, 29 December 2010

Wi-Fi tools I’m using on my Android

While 7Mbps 3G speeds are nice, Wi-Fi is even nicer. That’s why I try connecting to a Wi-Fi network whenever possible. It just makes things that much easier and smoother. Lately I’ve taken advantage of a number of Wi-Fi tools to make the experience even better. With all four of them combined I’ve been killing it with the browsing speed.

The first two apps we’ve already covered. They are Lookator and WeFi. Lookator is the sexier of the apps, since it uses Augmented Reality to place the source of Wi-Fi hotspots on your screen. I won’t lie: I’ve stood under someone’s apartment window and jacked their unsecured Wi-Fi. Why would they leave it unsecured in the first place? This also works well with WeFi, which is a hotspot database that already contains 74 million-plus hotspots. As I said when I first wrote about these, they’re permanently on my device.

Because I so greatly prefer Wi-Fi, I’d also prefer that my handset automatically detect a connection and set me up. That way I can retrieve my phone from my pocket and go nuts without having to actually connect. While I haven’t been able to find an app that will automatically connect me to an unsecured or public hotspot, I do have Wi-Fi Auto On. It will automatically connect me to hotspots I’ve already used. This goes well with public spots you often hit, such as the new hotspots in New York City. Just walking in the area will turn on Wi-Fi,which means I’ll be experiencing fast speeds right out of my pocket.

When I’m home I also want to use Wi-Fi, since I get only two bars of service inside my apartment. That made WiFi Automatic the perfect solution. It automatically turns on Wi-Fi when you connect your charger, and turns it off when you disconnect. Since my phone is charging nearly all the time at home, this makes complete sense. The only thing I wish it did was allow me to stay connected to my current hotspot until I leave it. Then it turns WiFi off. But hey, I’ll take what I can get for free.

All of these apps are available in the Market.
Source: andgeeks