Hi,

I add the zip file into the Bindings Library project as a LibraryProjectZip.

The code for creating the control:

using DE.Ankri.Views;
...
protected Switch _control;  //Switch is the class from the library project
_control = new Switch(context);
...
_layout.AddView(control, layoutParams);


Please see the logcat:

E/ThrottleService(  147): problem during onPollAlarm:
java.lang.IllegalStateException: problem parsing stats:
java.io.FileNotFoundException: /proc/net/xt_qtagui
d/iface_stat_all: open failed: ENOENT (No such file or directory)
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)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1196)
E/AndroidRuntime( 9741):        at
android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime( 9741):        at
android.widget.ScrollView.onMeasure(ScrollView.java:318)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
E/AndroidRuntime( 9741):        at
android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
E/AndroidRuntime( 9741):        at
android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
E/AndroidRuntime( 9741):        at
android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime( 9741):        at
com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148)
E/AndroidRuntime( 9741):        at
android.view.View.measure(View.java:15172)
E/AndroidRuntime( 9741):        at
android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1850)
E/AndroidRuntime( 9741):        at
android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
E/AndroidRuntime( 9741):        at
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1275)
E/AndroidRuntime( 9741):        at
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
E/AndroidRuntime( 9741):        at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
E/AndroidRuntime( 9741):        at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
E/AndroidRuntime( 9741):        at
android.view.Choreographer.doCallbacks(Choreographer.java:555)
E/AndroidRuntime( 9741):        at
android.view.Choreographer.doFrame(Choreographer.java:525)
E/AndroidRuntime( 9741):        at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
E/AndroidRuntime( 9741):        at
android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 9741):        at
android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 9741):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 9741):        at
android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 9741):        at
java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 9741):        at
java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 9741):        at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 9741):        at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 9741):        at dalvik.system.NativeStart.main(Native
Method)

D/dalvikvm( 9741): GC_CONCURRENT freed 223K, 4% free 8434K/8775K, paused
187ms+94ms, total 383ms
W/ActivityManager(  147):   Force finishing activity
com.test/monoproject.TestActivity
W/ActivityManager(  147):   Force finishing activity
com.test/monoproject.SplashActivity
D/dalvikvm(  147): GC_CONCURRENT freed 1038K, 15% free 11790K/13831K,
paused 75ms+159ms, total 547ms
W/ActivityManager(  147): Activity pause timeout for ActivityRecord


==============

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


How could I resolve it? Thanks a lot.


On 12 April 2013 19:52, Jonathan Pryor <[email protected]> wrote:

> On Apr 12, 2013, at 9:50 AM, Chas Xu <[email protected]> wrote:
> > However the app just crashes after the main activity set content view.
>
> What's the crash?
>
> In your Java Bindings Library project, what's the Build action for your
> .jar? If it's EmbeddedJar, it will be included into the binding .dll and
> you won't need to separately add the .jar to referencing app projects.
>
>  - Jon
>
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to