Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4867] Adding A View to a window is crashing Using CommonJS

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2017-03-21T20:44:31.000+0000
Affected Version/sAppcelerator Studio 4.3.0
Fix Version/sn/a
ComponentsAppcelerator Modules
LabelsCommonJS, Crash, View
ReporterIshan Singh
AssigneeShak Hossain
Created2017-03-21T15:31:01.000+0000
Updated2017-03-21T20:44:31.000+0000

Description

Hi I am having this code exports.alarmPicker = function(args) { var that = this; var param = args; var alarmPicker = Ti.UI.createPicker({ selectionIndicator : true, bottom : 0, left : 0, right : 0, type : Ti.UI.PICKER_TYPE_DATE_AND_TIME }); alarmPicker.addEventListener('change', function(e) { Ti.API.info(JSON.stringify(e)); }); var transparent = Ti.UI.createView({ top : 0, height : Ti.UI.FILL, width : Ti.UI.FILL, backgroundColor : 'transparent', zIndex : 2 }); var transparentGradientView = Ti.UI.createView({ top : 0, height : Ti.UI.FILL, width : Ti.UI.FILL, backgroundColor : 'gray', opacity : 0.6 }); transparent.add(transparentGradientView); transparent.add(alarmPicker); var alarmTitle = Titanium.UI.createLabel({ text : L('alarmTitleLabelText', 'Alarm'), color : '#000000' }); var toolBar = undefined; var set = undefined; var cancel = undefined; if (OS_IOS) { set = Titanium.UI.createButton({ title : L('setPickerTitle', 'Set'), style : Titanium.UI.iOS.SystemButtonStyle.DONE, }); cancel = Titanium.UI.createButton({ systemButton : Titanium.UI.iOS.SystemButton.CANCEL, title : L('cancelPickerTitle', 'Cancel') }); var flexSpace = Titanium.UI.createButton({ systemButton : Titanium.UI.iOS.SystemButton.FLEXIBLE_SPACE }); toolbar = Titanium.UI.iOS.createToolbar({ items : [cancel, flexSpace, alarmTitle, flexSpace, set], bottom : 0, borderTop : true, borderBottom : false }); } else { set = Titanium.UI.createButton({ title : L('setPickerTitle', 'Set'), right : '20dp', color : '#167AFF', backgroundColor : 'transparent' }); cancel = Titanium.UI.createButton({ title : L('cancelPickerTitle', 'Cancel'), left : '20dp', color : '#167AFF', backgroundColor : 'transparent' }); toolbar = Titanium.UI.createView({ height : 50, width : Ti.UI.FILL, backgroundColor : '#EAEAEA' }); toolbar.add(cancel); toolbar.add(alarmTitle); toolbar.add(set); } transparent.add(toolbar); cancel.addEventListener('click', function(e) { that.remove(); args.alarmSwitch.value = 0; args.alarmLabel.setVisible(false); args.alarmLabel.setText(''); }); set.addEventListener('click', function(e) { param.callback(alarmPicker.value); that.remove(); }); toolbar.addEventListener('postlayout', function(e) { this.bottom = alarmPicker.size.height; }); this.remove = function(e) { args.window.remove(transparent); }; this.add = function(e) { args.window.add(transparent); }; }; When i am calling .add method i am getting the crash attached. This seems to be a bug and is critical

Attachments

FileDateSize
device-2017-03-21-205222.png2017-03-21T15:30:16.000+0000372455

Comments

  1. Sharif AbuDarda 2017-03-21

    hello, Please provide a full reproducible code for us to test. Your code has missing component. Please share a project that reproduce the issue. Thanks.
  2. Ishan Singh 2017-03-21

    Hi, Just saw the console logs in detail. It says Date_Time picker is not allowed in android. How is it possible, also in api docs there is nothing like that mentioned
  3. Ishan Singh 2017-03-21

    PickerProxy: The useSpinner property is deprecated. Please refer to the documentation for more information [WARN] : PickerProxy: Date+Time timer not supported in Titanium for Android [WARN] : W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.appcelerator.titanium.view.TiUIView.registerForTouch()' on a null object reference [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:499) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:514) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:677) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:571) [WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [WARN] : W/System.err: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:872) [WARN] : W/System.err: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1095) [WARN] : W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:354) [WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98) [WARN] : W/System.err: at android.os.Looper.loop(Looper.java:158) [WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7229) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Native Method) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  4. Ishan Singh 2017-03-21

    Well close this issue. Thanks, I found a work around

JSON Source