[mono-android] Implementing 'UncaughtExceptionHandler'

Jonathan Pryor jonp at xamarin.com
Tue Jun 26 15:55:23 UTC 2012


On Jun 25, 2012, at 7:13 PM, PedroC wrote:
> Hello. I'm trying to implement 'UncaughtExceptionHandler' for Monodroid as seen in the following link:
> 
> http://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application
> 
> but with no success. I have tried to code as you see next but with no success and can't find anyware an implementation for 'IUncaughtExceptionHandler'.

IUncaughtExceptionHandler is a nested type; it's Java.Lang.Thread.IUncaughtExceptionHandler:

	http://androidapi.xamarin.com/?link=T%3aJava.Lang.Thread.IUncaughtExceptionHandler

Furthermore, you should never implement IJavaObject yourself. Instead, you should inherit Java.Lang.Object:

	public class CMUncaughtExceptionHandler : Java.Lang.Object, Java.Lang.Thread.IUncaughtExceptionHandler {
		public void UncaughtException(Thread thread, Throwable throwable)
		{
			// ...
		}
	}

 - Jon



More information about the Monodroid mailing list