Android: The Mysterious NullPointerException

The Problem One day it was just there. A mischievous NullPointerException causing, eh, mischief. It was fairly easy to provoke with my application but for some reason my code was not part of the stacktrace. 12-07 14:42:52.722 E/AndroidRuntime(18421): FATAL EXCEPTION: main 12-07 14:42:52.722 E/AndroidRuntime(18421): java.lang.NullPointerException 12-07 14:42:52.722 E/AndroidRuntime(18421): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064) 12-07 14:42:52.722 E/AndroidRuntime(18421): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081) [...]

Tags: , ,

Getting started with Android NDK

Per-Erik Bergman

You want to try out the Android NDK? I have gotten a lot of questions about how to setup and work with the NDK and I decided to write down how I do it. My goal with this entry is to gather all the information you need to get started with the Android NDK. I [...]

Tags: , , ,

Invoke any Method on any Thread

Fredrik Olsson

I previously wrote a blog post titled Performing any Selector on the Main Thread detailing a convenience category on NSInvoication for easily creating invocation objects that could be invoked on any thread. This category has served me well, and even got traction in the iOS developer community, so I never bothered to stop and think [...]

Tags: , , , , , , , ,

Secure JMS, Spring and WebLogic – a One Click Workaround

Olof Åkesson Vlado Palczynski

In our current assignment we are building a messaging based integration solution using Spring Integration and deploying it on WebLogic. In general, this has been quite a good experience as Spring Integration is a pleasant framework to work with from a developer’s perspective and the customer is happy that it will be rolled out on [...]

Tags: , ,

Dapper-dot-net aka Micro-ORM

Björn Carlsson

a simple object mapper for .NET After listening to Hanselminutes show #262 I became curious and have looked a bit at Dapper to check what it really is. First of all, it’s implemented as a single file you can drop in your project. It’s created for and at stackoverflow. I heard somewhere that it should [...]

Tags: , , ,

Sync-Async Pair Pattern – Easy concurrency on iOS

Fredrik Olsson

Apple provides many tools for implementing concurrency in your application. NSOperationQueue, GCD, or simply using performSelectorInBackground:withObject: that is available on each and every object, are just some examples. The tools are there, yet implementing good concurrency is hard. The solution I have found is not yet another tool, or framework, but a simple pattern. I [...]

Tags: , , , , ,

jstack to the rescue

Jimmy Falkbjer

On my current assignment we have amongst other things a Web Service. We use Apache CXF 2.3.2 as Web Services framework. The number of requests has increased heavily the last couple of months and currently we have about 20 requests a second, around the clock. We decided to move the Web Service to its own [...]

Tags: , ,

Automated Testing is Like Optimizing

Fredrik Olsson

I have my roots in the Atari demo scene, so I know the joys of optimizing the inner-loop of a software texture mapper down to the last assembly instruction. The bragging rights of knowing that not a single clock cycle is wasted. I am also grown up enough to know that this is not a [...]

Tags: , , ,

OpenGL ES Tutorial for Android – Part VI – Textures

Per-Erik Bergman

Last tutorial we worked a bit more on meshes and we have also talked about adding colors to our mesh. The most common way of adding colors to your mesh is to add a texture. There is a couple of different steps involved with adding a texture to the mesh I will try to go [...]

Tags: , ,

Exceptions and Errors on iOS

Fredrik Olsson

Cocoa, and by inheritance Cocoa Touch on iOS makes a clear distinction between what is an exception, and what is an error in your application. This should be obvious since NSException and NSError both inherit from the NSObject root class with no relations at all. Programmer vs. User Exceptions are intended for signaling programming errors [...]

Tags: , , , ,

Future Cocoa Operation

Fredrik Olsson

In Java you have for quite some time had the Future interface for encapsulating an asynchronous calculation. Cocoa has had the abstract NSOperation class to encapsulate asynchronous operations. NSOperation do not have any facilities for returning a result when done as the Future do, you are left to implement this on your own. Which I [...]

Tags: , , , , , , ,

Introduction to snmp4j

Johan Rask

Update 2010-09-22: Asynchronous fetch which is tested with Awaitility. SNMP is a widely accepted technology and is used in to monitor a wide variety of devices, but as it turns out very few people (at least among java programmers) seems to know anything about how to build snmp based solutions. This post will not discuss [...]

Tags: , , , ,

Extending the JDT

Michael Kober

A couple of weeks ago I had a look at the Motodevstudio for Android developers and I think it has some quite nice features like code snippets or wizards for Android activities, services and more. Actually it’s is quite easy to extend the eclipse JDT and provide such useful plugins. This blog post is about [...]

Tags: , , , ,

Performing any Selector on the Main Thread

Fredrik Olsson

Many UI frameworks, including AppKit for Mac OS X and UIKit for iPhone OS, require that all methods to UI components are sent on the main UI thread. Cocoa and Cocoa Touch make this quite easy by providing for example -[NSObject performSelectorOnMainThread:withObject:waitUntilDone:] in Foundation. Making updating the text for a text field a snap: [someTextField [...]

Tags: , , , , , , , , ,

Performance nightmare

Björn Carlsson

22 to 0.3 seconds! I found a simple solution to a very common problem. While profiling I found that remove in this little method took a lot of the time. public void MovePropertyFirst(IProperty property) { properties.Remove(property); properties.Insert(0, property); } The reason was, that it’s time consuming to compare the properties by equality, for complex types. [...]

Tags: , , , ,