Accessing Java Classes from Mono for Android via JNI

Mono for Android let’s you write Android applications in a .NET language (for example, C#). It comes with wrappers for almost the entire Android API so building “standard” apps is easy enough. However, sometimes you may need to work with third party Java classes that aren’t part of Android itself. These classes usually come as a .jar file. Fortunately, Mono for Android provides a way to access those Java classes. Unfortunately, this way is a “little” bit tricky and documentation on this is (currently) quite limited.

This article will show some basic example of how to call a method of a Java class from Mono for Android. We will use Visual Studio 2010 in this article, as it is (in my opinion) currently superior to Mono Develop.

Update: Mono for Android v4.2 and higher provides an automatic way for doing the things described in this article. This is a lot easier than the manual way and thus the preferred way.

Read more →

Passing native pointers across C++/CLI assembly boundaries

C++/CLI allows you to mix native C++ code with managed .NET code (which is extremly nice). Mixing such code also allows you to create methods in a .NET class that take or return pointers to native (C++) classes. Unfortunately, this doesn’t work out of the box across assemblies (read: DLLs). If you define a .NET class in one assembly and this class has a method that returns a pointer, you may not be able to use this method from within another C++/CLI assembly.

This article describes the problem and shows solutions.

Read more →

Unit Testing Framework for MonoDroid

Currently MonoDroid (or “Mono for Android”) is lacking a unit testing framework. Since Xamarin (the guys behind MonoDroid) enable us to use C# on almost every platform it would be nice to be able to reuse C# unit tests written for Visual Studio on other platforms, such as Android.

This is the goal behind the MonoDroid Unit Testing Framework which can be obtained here:

Happy testing!

Overview over all testsDetails about one test method

Show Email Addresses in Outlook 2011

If you want Outlook 2011 (for Mac) to display the actual email address for the sender or recipient of an email:

  1. Hover your mouse cursor over the name. A contact card will appear.
  2. Hover your mouse cursor over the name in the contact card. The email address will apear in a tooltip.

Show email address in Outlook 2011