0

I follow this guide to inherit a class, but i get crash with dalvik.system.NativeStart.main(native method) error

var MyDatePicker = android.widget.DatePicker.extend({
    init: function() {
        var isConstructor = arguments[arguments.length - 1];
        if (isConstructor) {
            // we are called from Java constructor
            console.log('con')
        } else  {
            // we are called from Java init method
            console.log('init');
        }
    }
});

var foo = new MyDatePicker();

1 Answer 1

1

According Android documentation (http://developer.android.com/reference/android/widget/DatePicker.html) DatePicker constructor takes at least one parameter (context). Try passing it, for example

var foo = new MyDatePicker(context);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.