Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support MapView #4

Closed
manumaticx opened this issue Nov 12, 2014 · 17 comments

Comments

@manumaticx
Copy link
Owner

commented Nov 12, 2014

@manumaticx manumaticx added the bug label Nov 12, 2014
@manumaticx manumaticx self-assigned this Nov 12, 2014
@shodanuk

This comment has been minimized.

Copy link

commented Dec 9, 2014

How are you getting on with this? Would like to use Ti.DrawerLayout but need to support a mapview and currently adding one crashes the app :(

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 10, 2014

This is high priority on my list. I also need to get this working and I really worked hard to find a solution but didn't succeed yet. I'll get back on this asap!

@shodanuk

This comment has been minimized.

Copy link

commented Dec 10, 2014

Sadly, I can't offer much help as I'm not an Android developer. I can offer moral support though: "You can do this", "I believe in you!" etc. ;)

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 11, 2014

I've pushed my current attempts on a separate branch mapview-support.

If someone here has an idea how to solve this, please help!

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 11, 2014

For the reference, here's the crash-log:

12-11 15:28:39.909: E/TiApplication(8775): (main) [571,571] Sending event: exception on thread: main msg:android.content.res.Resources$NotFoundException: Unable to find resource ID #0x3e8; Titanium 3.6.0,2014/12/11 14:51,7bde3b5
12-11 15:28:39.909: E/TiApplication(8775): android.content.res.Resources$NotFoundException: Unable to find resource ID #0x3e8
12-11 15:28:39.909: E/TiApplication(8775):  at android.content.res.Resources.getResourceName(Resources.java:2026)
12-11 15:28:39.909: E/TiApplication(8775):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:939)
12-11 15:28:39.909: E/TiApplication(8775):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
12-11 15:28:39.909: E/TiApplication(8775):  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
12-11 15:28:39.909: E/TiApplication(8775):  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
12-11 15:28:39.909: E/TiApplication(8775):  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
12-11 15:28:39.909: E/TiApplication(8775):  at android.os.Handler.handleCallback(Handler.java:739)
12-11 15:28:39.909: E/TiApplication(8775):  at android.os.Handler.dispatchMessage(Handler.java:95)
12-11 15:28:39.909: E/TiApplication(8775):  at android.os.Looper.loop(Looper.java:135)
12-11 15:28:39.909: E/TiApplication(8775):  at android.app.ActivityThread.main(ActivityThread.java:5221)
12-11 15:28:39.909: E/TiApplication(8775):  at java.lang.reflect.Method.invoke(Native Method)
12-11 15:28:39.909: E/TiApplication(8775):  at java.lang.reflect.Method.invoke(Method.java:372)
12-11 15:28:39.909: E/TiApplication(8775):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
12-11 15:28:39.909: E/TiApplication(8775):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
12-11 15:28:39.937: E/AndroidRuntime(8775): FATAL EXCEPTION: main
12-11 15:28:39.937: E/AndroidRuntime(8775): Process: de.manumaticx.test.drawermap, PID: 8775
12-11 15:28:39.937: E/AndroidRuntime(8775): android.content.res.Resources$NotFoundException: Unable to find resource ID #0x3e8
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.content.res.Resources.getResourceName(Resources.java:2026)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:939)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.os.Handler.handleCallback(Handler.java:739)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.os.Handler.dispatchMessage(Handler.java:95)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.os.Looper.loop(Looper.java:135)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at android.app.ActivityThread.main(ActivityThread.java:5221)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at java.lang.reflect.Method.invoke(Native Method)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at java.lang.reflect.Method.invoke(Method.java:372)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
12-11 15:28:39.937: E/AndroidRuntime(8775):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
12-11 15:28:39.938: W/ActivityManager(721):   Force finishing activity de.manumaticx.test.drawermap/org.appcelerator.titanium.TiActivity
12-11 15:28:39.940: W/ActivityManager(721):   Force finishing activity de.manumaticx.test.drawermap/.DrawermaptestActivity

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 11, 2014

Uploaded Test app to reproduce this here:
https://github.com/manumaticx/Ti.DrawerLayout.MapTest

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 12, 2014

To summarize my tests and attempts:

The Drawers centerView / contentView is implemented as a Fragment and all is working fine as long as our contentView is an instance of TiUIView here.
Now a mapView is implemented as a TiUIFragment, so we are nesting Fragments. This should actually not be a problem. But I'm afraid there is no way of telling the mapView to use our FragmentManager. And this is where I begin to stumble. It seems the FragmentManager is not able to resolve the container resource. But you can't really backtrace this exception to our code or the map view source.

Edit:
I'm pretty sure that this is the container which can not be resolved. I've tried to compile the ti.map module with the current master (including appcelerator/titanium_mobile#6414) with the updated TiUIFragment but still get the same Exception.

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Dec 16, 2014

I have also created a JIRA ticket for this: TIMOB-18244

@mokesmokes

This comment has been minimized.

Copy link

commented Feb 4, 2015

The Ti.map API will need to be modified to receive the container somehow.

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Feb 4, 2015

@mokesmokes Thanks for having a look. I really was hoping for your help!

As I commented on the ti.map issue the TiUIFragment instance seems to lose its self-created container. I'm not sure if this is only happens when nesting the map in another fragment because the crash can be reproduced without a parent fragment. A simple test is the code in the ticket:

Ti.UI.createAlertDialog({
    androidView: require('ti.map').createView()
}).show();

Do you have any idea what could be the reason? I really appreciate your investigation!

@mokesmokes

This comment has been minimized.

Copy link

commented Feb 4, 2015

The reason is that you need to add the map to your fragment, but the current Ti.Map and TiUiFragment have no reference to your fragment. So basically, this functionality needs to be added. See http://stackoverflow.com/questions/13733299/initialize-mapfragment-programmatically-with-maps-api-v2 for maps in a fragment.

@muka

This comment has been minimized.

Copy link

commented Feb 9, 2015

Hi @mokesmokes
I've worked a bit on the ti.map module and I'd be happy to help out on this.

I've tried following the approach you used in this commit (appcelerator/titanium_mobile@f1925ac) and in the link above (by extending SupportMapFragment) with no luck, the same error pop out (resource not found)

I've also tried to "clone" the TiUIFragment for the ti.map View (based on the 3.5.0.GA code), adding a custom tag to the fragment and checking then in the drawer code for it.
Same also with container id (which seems to be the default beahviour)

After some experiments, the FragmentManager doesn't know about the MapFragment, even if specified via tag. Seems it is not yet available, I still would like to try by forcing the transaction ( executePendingTransactions)

Could you help a bit describing which functionality is missing?

Thank you very much
Regards

@manumaticx manumaticx removed the bug label Feb 10, 2015
@Brian-McBride

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2015

Has anyone gotten a maps module build that will work with the drawer?

I think that the maps module needs love in general. Sometime in the last gear getRegion() broke on Android. Of course, that matters little when the map crashes the app in the drawer here.

By the way, this will also crash other popular drawers like dk.napp.drawer.

@john-dalsgaard

This comment has been minimized.

Copy link

commented Feb 20, 2015

Thanks for your effort on solving this. I am afraid I don't have the skills (yet) to help out on solving it....

Stuck with same issue - and also realizes that all drawers seem to run into this issue :-(

@manumaticx manumaticx referenced this issue Mar 2, 2015
@AppWerft

This comment has been minimized.

Copy link

commented Mar 2, 2015

In my case the app doesn't crash, but the view keeps empty. Next try: embedding of mapview in a view container and this container is „contentView“ of drawer: same result.
screenshot_2015-03-02-17-39-19

@manumaticx

This comment has been minimized.

Copy link
Owner Author

commented Mar 25, 2015

Okay, this can be considered as fixed - whoop! 😃

Please follow the testing steps here: TIMOB-18244

Massive thanks to @hieupham007 for his excellent work on this issue!

@albert0m

This comment has been minimized.

Copy link

commented Jan 31, 2018

it's still crashing on my side. I tried to wrap the mapView in a View but it still crashes.

<Alloy>
	<Window module="xp.ui" role="main">
		<LeftNavButton platform="ios">
			<Require src="_menuButton" />
		</LeftNavButton>
		<View height="Ti.UI.SIZE" layout="vertical">
			<Module id="mapview" module="ti.map" method="createView" />
		</View>
	</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.