-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Update mapsandlocationdemo-v3 to not use deprecated Android.App.Fragment #322
Comments
Hello, by XAMARIN Examples to use gmap i have used this code; This code works, but on AndroidX is is deprecated. The code is a part of an activity (public class GeoActivityMap : Activity, IOnMapReadyCallback) All what i found is this example, but that Example has the same issue: Have everybody a solution? |
It looks like You can try adding the |
Hello @jpobst , i have installed the Nuget Have the "Using" but what i see: On Support-Lib no FindFragmentByID: |
There definitely isn't a generic version of it, so you'll need something like:
I think the other issue is that this isn't a |
Sorry, you a using C# on VS2019? My code is based on this Xamarin Example: So this Xamarin Example has the same issue. |
I am just looking at your screenshots. For example, why does |
That looks closer. The remaining issue is that there isn't a generic version of
|
I don't know if this will work at runtime, but it should at least compile:
|
Honestly, I would probably just live with the deprecated warning until you move your application to AndroidX. The AndroidSupport libraries are deprecated as well, they just don't have a the types marked that way. AndroidX is the way forward. |
That's what it's all about right now. We want to use the application on Xamarin.AndroidX and have also installed the Xamarin.Migrator first. Obviously the migration is not clean and now I need a solution, because "outdated code in an application is never an acceptable solution. |
Ok, then back to your first screenshot. The issue is you are using the deprecated You will need to update your code to use the AndroidX one instead, which will likely involve the same steps (inherit from |
I would love to do that if someone would tell me how to do this with Xamarin. Xamarin only documented that you should use the Xamarin.AndroidX.Migrator and you can now see what comes out of it. |
Let's make it easy: from: Using Android.Support.V4.App is under AndroidX ..... Using AndroidX ....... Unfortunately, the Android documentation is only of limited help to Xamarin programmers, as the syntax used is different. |
In order to use the AndroidX version, you will need to do the steps I outlined:
|
I also think that you can expect the Xamarin developers to adapt the examples for Google Maps and not offer old code as an example that no longer works, as is currently the case. Migration also means being able to provide appropriate examples and keeping existing examples up to date. |
I change this: to: and then i got some new issues: values.xml(6): error APT1000: Attribute "mapType" already defined with incompatible format. __________________ value.xml ___________________ After change back to: we have the errors also. - s 10 hours work are lost now, because we have no solution for the new issue. |
@jpobst - The other issue on "values.xml" we found. Is only in "Debug-Mode" so think that Microsoft has a VS2019 issue. Back to this issue - got a null reference, so also this does not work: and the oster code-line, you send me: |
This seems to be due to a difference in how the Calling the same code, the This seems to be referred to in Google's documentation here. Specifically:
This fragment is defined as:
Some more info is here: https://stackoverflow.com/questions/35059822/android-childfragmentmanager-findfragmentbyid-always-null. I think your best option is to continue using the original |
The remaining issue here seems to be to update the |
Xamarin.Android Version (eg: 6.0):
Operating System & Version (eg: Mac OSX 10.11):
Support Libraries Version (eg: 23.3.0):
Describe your Issue:
Steps to Reproduce (with link to sample solution if possible):
Include any relevant Exception Stack traces, build logs, adb logs:
The text was updated successfully, but these errors were encountered: