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();
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);