Comments (8)
The Google documentation is a liar: there is NO setChoiceMode() in API Level 10.
from xamarin-android.
Therefore this is a bugfix. monodroid-samples should be fixed to not invoke nonexistent method.
from xamarin-android.
@atsushieno I am not sure about this, perhaps your local documentation is the one that is lying...
Here is a java port that has a min, target, and compile version of 10, and successfully uses the following code:
String[] items = new String[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, items));
ListView lv = (ListView)findViewById(android.R.id.list);
lv.setChoiceMode(1);
from xamarin-android.
Why don't just check sources?
from xamarin-android.
@atsushieno: It's not AbsListView
, it's ListView
, which does contain a ListView.getChoiceMode()
method.
Furthermore, src/Mono.Android/Profiles/api-10.xml.in
contains a ListView.getChoiceMode()
method:
<class abstract="false" deprecated="not deprecated" extends="android.widget.AbsListView" extends-generic-aware="android.widget.AbsListView" final="false" name="ListView" static="false" visibility="publi
...
<method abstract="false" deprecated="not deprecated" final="false" name="getChoiceMode" native="false" return="int" static="false" synchronized="false" visibility="public">
The oddity here is that the d15-6 binding of API-10 in Mono.Android.dll
doesn't contain any mention of ChoiceMode
:
# From extracted output of xamarin.android-8.2.0-4.pkg
$ monodis --method .../lib/xbuild-frameworks/MonoAndroid/v2.3/Mono.Android.dll | grep ChoiceMode
# no matches
Compare to e.g. 8.1:
$ monodis --method /Library/Frameworks/Xamarin.Android.framework/Versions/8.1.2-0/lib/xbuild-frameworks/MonoAndroid/v2.3/Mono.Android.dll | grep ChoiceMode
28486: default class [mscorlib]System.Delegate GetGetChoiceModeHandler () (param: 32420 impl_flags: cil managed )
28487: default int32 n_GetChoiceMode (native int jnienv, native int native__this) (param: 32420 impl_flags: cil managed )
28488: default class [mscorlib]System.Delegate GetSetChoiceMode_IHandler () (param: 32422 impl_flags: cil managed )
28489: default void n_SetChoiceMode_I (native int jnienv, native int native__this, int32 native_choiceMode) (param: 32422 impl_flags: cil managed )
28490: instance default valuetype Android.Widget.ChoiceMode get_ChoiceMode () (param: 32425 impl_flags: cil managed )
28491: instance default void set_ChoiceMode (valuetype Android.Widget.ChoiceMode 'value') (param: 32425 impl_flags: cil managed )
I do not currently understand where the ListView.ChoiceMode
property went: Profiles/api-10.xml.in
mentions it, methodmap.csv
mentions it...
...and I think I have the cause:
$ pwd
…/xamarin-android/src/Mono.Android
# Build API-10:
$ xbuild /v:diag /p:AndroidFrameworkVersion=v2.3 /p:AndroidApiLevel=10 > b.txt
The resulting b.txt
contains:
warning BG8700: Unknown return type Android.Widget.ChoiceMode in method GetChoiceMode in managed type Android.Widget.ListView.
warning BG8800: Unknown parameter type Android.Widget.ChoiceMode in method SetChoiceMode in managed type Android.Widget.ListView.
The cause of this bug is a301764, which changed Android.Widget.ChoiceMode
from being declared in API-1 to being declared in API-15.
from xamarin-android.
ChoiceMode was removed because they were generated from AbsListView fields which DOES NOT EXIST in API Level 10. And getChoiceMode() and setChoiceMode are removed because they expect NONEXISTENT enums.
Fortunately they are in ListView in API Level 10, so they can be generated from there.
Although, while I can build Mono.Android.dll for the profiles including android-10, make framework-assemblies
fails and I cannot verify the entire build locally.
Build FAILED.
Errors:
src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj: error : /sources/xamarin-android/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj: /sources/xamarin-android/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj could not import "$(OutputPath)\..\..\..\xbuild\Xamarin\Android\Xamarin.Android.CSharp.targets"
0 Warning(s)
1 Error(s)
from xamarin-android.
To make sure: (1) ChoiceMode being removed in API Level 10 was correct. (2) Leaving ListView.SetChoiceMode() and .GetChoiceMode() to point to non-existent enum and not converting ListView. flelds to ChoiceMode is wrong (only when both conditions are met).
from xamarin-android.
Verified fixed in monodroid/d15-6/09b922fe.
from xamarin-android.
Related Issues (20)
- how to use c++ dll in .net android (or MAUI android)? HOT 2
- Xamarin.Android.Aapt2.targets(123,3): error APT2144 com.stripe:stripe-android:20.40.4 HOT 12
- HttpClient and AcceptEncoding gzip on Android stoped working after latest SR4 release. HOT 17
- Unable to turn off Fast Deployment for .Net8 Maui Android project HOT 6
- [Question] A way to connect Mono Debugger for the Release builds
- Trimming still seems to break android push notifications on MAUI .net 9 preview 3 HOT 2
- `TrimMode=full` seems to break android push notifications on MAUI .net 9 preview 3 HOT 10
- Assetpack file not included on "Debug" compilation HOT 3
- AndroidMessageHandler: HTTP status code 308 is throwing an exception
- `InstallAndroidDependencies` target always warns about `tools`
- Fast Deploy issue on some Lollipop (5.1.1) devices HOT 1
- Lots of typemap errors triggered by XAML Live Preview HOT 1
- build issue typemaps.x86_64.ll: error: Could not open input file: no such file or directory HOT 14
- Downgrade android/ios .NET 8 workload to specific version HOT 1
- .NET MAUI Blazor Hybrid Localization issue HOT 1
- How to exclude some libraries to be trimmed in .NET 8 for Android, not MAUI? HOT 12
- App Crashes when using bundle.config with abi splits set to negate. HOT 5
- `[libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE)` after clearing cache and user data HOT 4
- Making nuget package with aar file always has first resource file corrupted HOT 8
- all maui app crash on a multi-user android system HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xamarin-android.