Wednesday, February 23, 2011

Android 3.0 ‘Honeycomb’ SDK now available


Google’s Android developer team has announced the first Android 3.0 (API Level: 11) software developer kit is available to developers to create apps and widgets for tablet devices.

Android 3.0 is a new version of the Android platform that is specifically optimised for devices with larger screen sizes, particularly tablets. It introduces a brand new 'holographic' UI design, as well as an elegant, content-focused interaction model.


New features include:

· UI Builder improvements in the ADT Plugin, including a new Palette tool with categories and rendering previews, more accurate rendering of layouts to more faithfully reflect how the layout will look on devices, including rendering status and title bars to more accurately reflect screen space actually available to applications.

Selection-sensitive action bars to manipulate View properties.

Zoom improvements (fit to view, persistent scale, keyboard access)

Improved support for layouts, as well as layouts with gesture overlays.

Traceview integration for easier profiling from ADT.

Tools for using the Renderscript graphics engine: the SDK tools now compiles .rs files into Java Programming Language files and native bytecode.


Fragments

A fragment is a new framework component that allows you to separate distinct elements of an activity into self-contained modules that define their own UI and lifecycle. To create a fragment, you must extend the Fragment class and implement several lifecycle callback methods, similar to an Activity. You can then combine multiple fragments in a single activity to build a multi-pane UI in which each pane manages its own lifecycle and user inputs.

You can also use a fragment without providing a UI and instead use the fragment as a worker for the activity, such as to manage the progress of a download that occurs only while the activity is running.

Fragments are self-contained and you can reuse them in multiple activities.

You can add, remove, replace and animate fragments inside the activity
You can add fragments to a back stack managed by the activity, preserving the state of fragments as they are changed and allowing the user to navigate backward through the different states
By providing alternative layouts, you can mix and match fragments, based on the screen size and orientation
Fragments have direct access to their container activity and can contribute items to the activity's Action Bar.


New animation framework

The platform includes a flexible new animation framework that lets developers easily animate the properties of UI elements such as Views, Widgets, Fragments, Drawables, or any arbitrary object. Animations can create fades or movement between states, loop an animated image or an existing animation, change colors, and much more. Adding animation to UI elements can add visual interest to an application and refine the user experience, to keep users engaged.


Hardware-accelerated 2D graphics

Android 3.0 offers a new hardware-accelerated OpenGL renderer that gives a performance boost to many common graphics operations for applications running in the Android framework. When the renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. Developers can control how hardware-acceleration is applied at every level, from enabling it globally in an application to enabling it in specific Activities and Views inside the application.


Renderscript 3D graphics engine

Renderscript is a runtime 3D framework that provides both an API for building 3D scenes as well as a special, platform-independent shader language for maximum performance. Using Renderscript, you can accelerate graphics operations and data processing. Renderscript is an ideal way to create high-performance 3D effects for applications, wallpapers, carousels, and more.


Support for multicore processor architectures

Android 3.0 is the first version of the platform designed to run on either single or multicore processor architectures. A variety of changes in the Dalvik VM, Bionic library, and elsewhere add support for symmetric multiprocessing in multicore environments. These optimizations can benefit all applications, even those that are single-threaded. For example, with two active cores, a single-threaded application might still see a performance boost if the Dalvik garbage collector runs on the second core. The system will arrange for this automatically.


System clipboard

Applications can now copy and paste data (beyond mere text) to and from the system-wide clipboard. Clipped data can be plain text, a URI, or an intent.

By providing the system access to the data you want the user to copy, through a content provider, the user can copy complex content (such as an image or data structure) from your application and paste it into another application that supports that type of content.

.. and more!

Sunday, February 13, 2011

TextView background is black when setting colour from xml?


I had a colour defined in a 'colours.xml' file in my project's 'values' folder like so:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="tvBackground">#337700</color>
</resources>

Which, for those of you who cannot transpose directly from hex, looks like this:

My code looked like this:

   TextView tv = new TextView(getApplicationContext());
       
   tv.setBackgroundColor(R.color.tvBackground);

Seems reasonable doesn't it?

But when I ran my code, my shiny new little TextView came out with the background colour of this:


(that's #000000 in hex, or 'black' btw)

What was going on here?
Turns out, I wasn't using the correct method to set the background colour so that it comes out correctly, what I should have used was either of these:

   tv.setBackgroundResource(R.color.tvBackground);
- or -
   tv.setBackgroundColor(getResources().getColor(R.color.tvBackground));


.. Not especially well documented, but easily fixed.


Anyhow, now my TextView shows with the background colour of:


.. So all is now well with the world. Thought I'd just post this in case it helps someone out there (or myself when I forget next time)


until that next time, bye bye.


Monday, February 7, 2011

Wino the Wine Advisor now updated, new features & grrraphics


I've recently released an update for my Wino the Wine Advisor app,
The new version now allows you to combine tastes and also has some great new wine bottle graphics (even if I do say so myself).

Here are some screenshots:





.. And I have to say, those wine bottle images were an absolute pain to create.

I use Gimp and Inkscape to create all my graphics, in case you were wondering.