Open treinberger opened 9 years ago
any solution on this?? even i am facing the same issue
Same problem here...
I have an app that creates a view with a map defined in the XML. This is then added to the centerWindow after the drawer has been opened. The map displays.
Now I have a new app that has a nested view which needs a map in it. So, in this case the center window has been defined with a view and within that view (a couple views deep) I am adding a map programmatically. This crashes the entire app.
The exact same process works just fine outside of the app.
<View id="container">
<View id="mapContainer" />
</View>
And the .js code:
var Map = require('ti.map');
var mapView = Map.createView({
mapType: Map.NORMAL_TYPE,
userLocation: false,
animate: false
});
$.mapContainer.add(mapView);
Finally, the error:
[WARN] dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41857da0)
[ERROR] TiApplication: (main) [7941,7941] Sending event: exception on thread: main msg:java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState; Titanium 3.5.0,2015/01/12 15:33,0014f83
[ERROR] TiApplication: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
[ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1354)
[ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1372)
[ERROR] TiApplication: at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
[ERROR] TiApplication: at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
[ERROR] TiApplication: at org.appcelerator.titanium.view.TiUIFragment.
Hmmm.... I seem to have the same problem. Any ideas for workarounds or solutions?
.... just found an error logged with this problem: https://jira.appcelerator.org/browse/TIMOB-18244. Apparently, a more general issue - and with no solution scheduled yet...
What about this one? https://jira.appcelerator.org/browse/TIMOB-18401 Will this fix the issue?
I just tested on Titanium 3.5 and am getting the error:
[ERROR] : TiApplication: Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1354)
[ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1372)
[ERROR] : TiApplication: at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
[ERROR] : TiApplication: at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiUIFragment.
Anyone heard back from AppC on this?
Some new info. Check out Hieu Pham's comment here: https://jira.appcelerator.org/browse/TIMOB-18244
Seems this route could be useful for nappDrawer.
No solution yet?
When I change the sample Android app to display a map using the map module (using SDK 3.4.1), I get the following error:
[INFO] : u: Making Creator dynamically [INFO] : I/Google Maps Android API: Google Play services client version: 6171000 [INFO] : I/Google Maps Android API: Google Play services package version: 6188038 [WARN] : ResourceType: No package identifier when getting name for resource number 0x000003e8 [WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41745da0) [ERROR] : TiApplication: (main) [585,585] Sending event: exception on thread: main msg:android.content.res.Resources$NotFoundException: Unable to find resource ID #0x3e8; Titanium 3.4.1,2014/11/13 13 :33,5982e8f [ERROR] : TiApplication: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x3e8 [ERROR] : TiApplication: at android.content.res.Resources.getResourceName(Resources.java:2687) [ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:930) [ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115) [ERROR] : TiApplication: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) [ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) [ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:733) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:157) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5335) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:515) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)
The sample app index.js is as following:
var MapModule = require('ti.map');
var rc = MapModule.isGooglePlayServicesAvailable();
switch (rc) { case MapModule.SUCCESS: Ti.API.info('Google Play services is installed.'); break; case MapModule.SERVICE_MISSING: alert('Google Play services is missing. Please install Google Play services from the Google Play store.'); break; case MapModule.SERVICE_VERSION_UPDATE_REQUIRED: alert('Google Play services is out of date. Please update Google Play services.'); break; case MapModule.SERVICE_DISABLED: alert('Google Play services is disabled. Please enable Google Play services.'); break; case MapModule.SERVICE_INVALID: alert('Google Play services cannot be authenticated. Reinstall Google Play services.'); break; default: alert('Unknown error.'); break; }
var leftMenuView = Ti.UI.createView({ backgroundColor:'white', width: Ti.UI.FILL, height: Ti.UI.FILL });
var centerView = Ti.UI.createView({ backgroundColor:'white', width: Ti.UI.FILL, height: Ti.UI.FILL });
var rightMenuView = Ti.UI.createView({ backgroundColor:'#ddd', width: Ti.UI.FILL, height: Ti.UI.FILL });
// create a menu var leftTableView = Ti.UI.createTableView({ font:{fontSize:12}, rowHeight:40, data:[ {title:'Toggle Left View'}, {title:'Change Center Windowr'}, {title:'Default Window'} ] }); leftMenuView.add(leftTableView); leftTableView.addEventListener("click", function(e){ Ti.API.info("isAnyWindowOpen: " + drawer.isAnyWindowOpen()); switch(e.index){ case 0: drawer.toggleLeftWindow(); //animate back to center alert("You clicked " + e.rowData.title + ". Implement menu structure.. "); break; case 1: drawer.setCenterWindow(Ti.UI.createView({backgroundColor:"red"})); drawer.toggleLeftWindow(); //animate back to center break; case 2: drawer.setCenterWindow(centerView); drawer.toggleLeftWindow(); //animate back to center break; } });
// Action Bar - FAKE example var actionBar = Ti.UI.createView({ top:0, height:"44dp", backgroundColor:"#333" }); var leftToolbarBtn = Ti.UI.createButton({ title:"Left", left: "6dp", backgroundColor:"transparent", color: "#FFF" }); leftToolbarBtn.addEventListener("click", function(){ drawer.toggleLeftWindow(); }); var rightToolbarBtn = Ti.UI.createButton({ title:"Right", right: "6dp", backgroundColor:"transparent", color: "#FFF" }); rightToolbarBtn.addEventListener("click", function(){ drawer.toggleRightWindow(); }); var centerLabel = Ti.UI.createLabel({ text:"NappDrawer", font:{ fontSize:"14dp", fontWeight:"bold" }, color: "#FFF" }); actionBar.add(leftToolbarBtn); actionBar.add(rightToolbarBtn); actionBar.add(centerLabel); centerView.add(actionBar);
// Create a default Map.View class var mapview = MapModule.createView({mapType:MapModule.NORMAL_TYPE});
centerView.add(mapview);
// CREATE THE MODULE var NappDrawerModule = require('dk.napp.drawer'); var drawer = NappDrawerModule.createDrawer({ fullscreen:false, leftWindow: leftMenuView, centerWindow: centerView, rightWindow: rightMenuView, fading: 0.2, // 0-1 parallaxAmount: 0.2, //0-1 shadowWidth:"40dp", leftDrawerWidth: "200dp", rightDrawerWidth: "200dp", animationMode: NappDrawerModule.ANIMATION_NONE, closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_MARGIN, openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL, orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT] });
// Action Bar - REAL example drawer.addEventListener('open', onNavDrawerWinOpen); function onNavDrawerWinOpen(evt) { this.removeEventListener('open', onNavDrawerWinOpen);
}
// lets open it drawer.open();
Any ideas how to fix this?