On Apr 12, 2013, at 5:47 PM, Chas Xu <[email protected]> wrote:
> Please see the logcat:
> 
> D/AndroidRuntime( 9741): Shutting down VM
> W/dalvikvm( 9741): threadid=1: thread exiting with uncaught exception 
> (group=0x40a13300)
> E/AndroidRuntime( 9741): FATAL EXCEPTION: main
> E/AndroidRuntime( 9741): java.lang.NullPointerException
> E/AndroidRuntime( 9741):        at 
> de.ankri.views.Switch.onMeasure(Switch.java:508)

This is where source would be handy; apparently your Switch instance is using 
some data from...somewhere...and that data is null. Perhaps you need to do some 
further initialization/configuration?

> I was then trying to create the control from an xml view:
> 
> _control = (Switch)AppContext.FindViewById(switchViewId);
> 
> The xml file:
> <?xml version="1.0" encoding="utf-8" ?>
> <DE.Ankri.Views.Switch 
> xmlns:android="http://schemas.android.com/apk/res/android";
>         android:layout_width="match_parent"
>         android:layout_height="wrap_content"
>         android:paddingLeft="20dp"
>         android:paddingRight="20dp"        
>         />
> 
> When I compile it, I get this error: 
> invalid symbol: 'switch'      ...\res\layout\switch.xml

Android resource filenames need to be valid Java identifiers. `Switch` is a 
Java keyword, and thus not a valid Java identifier. Rename Switch.xml to e.g. 
MySwitch.xml, and that should fix the issue.

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to