Bluetooth LE – Part 2

April 17th, 2014

Important note: Thanks to Sebastiano Poggi for pointing out a flaw in this article – the Service will actually run on the UI thread. Please bear with me for a day or two and I’ll get the article and code updated accordingly.

In the previous article we covered a bit of the background of Bluetooth LE and what we’re going to develop in this series, but there was no actual code. We’ll rectify that in this article and define the Service / Activity architecture that were going to use to ensure that we’re going to keep our Bluetooth operations of the UI thread.
Read the rest of this entry »

Bluetooth LE – Part 1

April 11th, 2014

At the time of writing, Google have just announced Android Wear, and Motorola announced the Moto 360 smart watch. The Wear APIs are still fairly basic, are quite well documented, and there are more to come, so I’m not going to write a tutorial on them (not yet, at least!). One interesting thing about the Moto 360 is that is supported on Android 4.3 and later. The most obvious reason for this is that Bluetooth LE is only supported in Android 4.3 and later, which would imply that the Moto 360 will support Bluetooth LE. Bluetooth LE is a technology that is going to be central to not only wearable technology, but to many IoT devices. In this series we’ll take a look at using Bluetooth LE on Android.
Read the rest of this entry »

App Polish

April 1st, 2014

Often we complete the functional aspect of an Android project, and when it comes to adding some sparkle to the UI to really make it appealing to the user inspiration can be a little lacking. In this article we’ll start of with a really functional but boring app, and turn it in to something much more exciting.
Read the rest of this entry »

Blurring Images – Part 7

March 28th, 2014

In the previous article we performed some simple optimisations which enormously improved the frame rate of our animations. However, we mentioned that increasing the size of the area that we wish to blur will slow the frame rate because the complexity of the blur operation will increase exponentially. In this article we’ll look at an alternative approach which should permit us to animate larger areas.
Read the rest of this entry »

Blurring Images – Part 6

March 21st, 2014

In the previous article we looked at frame rates, and explored how we can measure them by adding some simple benchmarking logging. In this article we’ll look at implementing our dynamic blurring so that we can animate things, and optimising things to improve our framerate.
Read the rest of this entry »

Blurring Images – Part 5

March 14th, 2014

So far in this series there have been quite a few mentions of frame rates, and assertions that we want to keep our frame rates as high as possible. In this article we’ll look a little closer at how we can measure frame rates, and explore how changes in our layouts and views can affect our frame rates.
Read the rest of this entry »

Blurring Images – Part 4

March 7th, 2014

Previously in this series we’ve looked at blurring an image using RenderScript, and a technique for analysing performance to work out where the bottlenecks are in the process. We found that the actual bur operation was extremely quick in RenderScript, but we did have an overhead of marshalling bitmaps from the Java memory space across to the RenderScript memory space and back again. In this article we’ll take a look at performing the blur in Java to remove the marshalling between memory spaces, and see if we can get better performance that way.
Read the rest of this entry »

Blurring Images – Part 3

February 28th, 2014

In the previous article we took a look at wiring up our blur method so that it was appended to the layout phase to ensure that it was called only following a layout change, and not in onDraw(). So why shouldn’t we call it in onDraw()? In this article we’ll perform some benchmarking which will help us to understand why.
Read the rest of this entry »

Blurring Images – Part 2

February 21st, 2014

Previously we looked at a method which uses RenderScript to blur the section of an image which lies within the bounds of another view. However we didn’t get as far as actually calling that method and see the blurring in action. The reason for this is that we need to think quite carefully about performance, and on this article we shall look in to this further.
Read the rest of this entry »

Blurring Images – Part 1

February 14th, 2014

There are a lot of cool effects that we can do in Android to manipulate images, and I cover some of these in my conference presentation for 2014 entitled Graphical Magic. One technique that I cover in the presentation is how to blur images and the example code uses RenderScript to perform the blur because there is no simple API built into Android that we can use. In this series we’ll look at both the RenderScript blurring technique, and also how we can also perform blurring in Java. We’ll also perform some benchmarking to understand how well each approach performs, and look at ways that we can obtain the best performance.
Read the rest of this entry »