Adding reference to Java.Util in .NET Core 2.1 project

42
March 20, 2019, at 01:50 AM

I'm writing unit tests to xamarin android project. I need class IEnumeration, which belongs to Java.Util namespace. There is no such package in nuget also i'm not able to see mono.android package. Is there any possibility to use java legacy classes outside xamarin android project?

Answer 1

In my case hiding these classes behind interfaces was sufficient. I recommend this approach for such awkward references. I Have made interface in core project (which returns standard ICollection) and its implementation in android project (which translates java wrapper IEnumartion to ICollection). Now everything is perfectly mockable.

READ ALSO
Can't build IoTivity Base Android API

Can't build IoTivity Base Android API

I am following this tutorial to build the IoTivity Base Android API:

42
how to disable screenshot on android p

how to disable screenshot on android p

Currently i am using FLAG_SECURE method to disable the screenshot functionality but users having Android P are able to take screenshotsHow to restrict that?

42
FragmentScenario configuration - Binary XML file line, Error inflating class <widget> while testing with espresso

FragmentScenario configuration - Binary XML file line, Error inflating class <widget> while testing with espresso

Inflating error while trying to use FragmentScenario with launchFragment and launchFragmentInContainer if using material component in XML

48
Mock a bluetooth device

Mock a bluetooth device

I have to mock a bluetooth device that would first pair with an Android device and then send predefined data to an Android appI have no access to source code of the app, but I managed to get bluetooth communication packets sent between devices (using...

38