on ‎2020 May 08 10:30 AM
Hi guys,
currently I develop an MDK application in Visual Studio Code using your MDK extension for VSC.
I added the extension you created from: https://developers.sap.com/tutorials/cp-mobile-dev-kit-map-extension.html. Note, that I didn't change any code, its the same version posted in the tutorial.
For iOS, the map works as expected, but for Android, I recognized some issue. I checked for your documentation (https://help.sap.com/viewer/977416d43cd74bdc958289038749100e/3.2/en-US/9411d35cb91a4a8986a2635b7375c...) and analogue to it, the Map extension tries to create a new instance for the "_mapView" variable (object of class MapView):
this._mapView = new com.google.android.gms.maps.MapView(this.androidContext());
This line, however, throws a java.lang.NullPointerException, because the context of android (this.androidContext()) is null for me.
In the second link I posted above, the following information is delivered about the androidContext:
androidContext() - this function returns the current page's context that will be needed to create an Android native view.
Do you have any idea, why this problem occurs? Do I maybe have to adjust something, since, e.g., the mdk client sdk has been changed? In my TypeScript-file, the current android context is null and that is why I think, that the NullPointerException is thrown.
Thank you in advance for your help!
Best regards,
Sher-Chan Kodirov
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
hi jitendrakumar.kansal,
for your info, I found the solution. After I exchanged the "this.androidContext()" with app.android.context in the code of your tutorial (for the map extension), I was finally able to display the correct result.
BR,
Sher-Chan Kodirov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Object {constructor: , _needRestart: false, _callbacks: ActivityCallbacksImplementation}
_callbacks:ActivityCallbacksImplementation {_rootView: Frame}
_needRestart:false
constructor:function () { … }
isNativeScriptActivity:true
skipExit:undefined
super:Object
__proto__:Activity {constructor: }
sherchan_kodirov19
I quickly tested same tutorial on Android client built using MDK SDK 4.2.1 and can see the expected result.
Which MDK SDK version you are trying with?
Did you already follow step#8 to add required info in grandle & AndroidManifest.xml files?
Regards
JK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi jitendrakumar.kansal,
by the way, I am using a macOS Catalina with Version 10.15.4 and I have the MDK SDK version "MDKCLNT02P_1-80005072". I setup my whole dev environment for both iOS & Android.
And yes, i followed step#8 setting gradle-file as well as AndroidManifest.xml file in the built application I use for debug app root.
BR,
Sher-Chan Kodirov
hi jitendrakumar.kansal ,
my colleague has a Windows device and he told me, that for him, the this.androidContext() was null, too.
However, in another extension, he created a new instance of an EditText (Android) https://developer.android.com/reference/android/widget/EditText.html
The textfield rendered for him, but in his Android debugger, "this.androidContext()" is also null.
Is it normal, that the debugger shows no data for that?
BR,
Sher-Chan Kodirov
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.