Git Product home page Git Product logo

Comments (8)

atsushieno avatar atsushieno commented on August 15, 2024

The Google documentation is a liar: there is NO setChoiceMode() in API Level 10.

image

from xamarin-android.

atsushieno avatar atsushieno commented on August 15, 2024

Therefore this is a bugfix. monodroid-samples should be fixed to not invoke nonexistent method.

from xamarin-android.

pjcollins avatar pjcollins commented on August 15, 2024

@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);

LVChoiceModeTest.zip

from xamarin-android.

atsushieno avatar atsushieno commented on August 15, 2024

Why don't just check sources?

https://android.googlesource.com/platform/frameworks/base/+/android-2.3.7_r1/core/java/android/widget/AbsListView.java

from xamarin-android.

jonpryor avatar jonpryor commented on August 15, 2024

@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.

atsushieno avatar atsushieno commented on August 15, 2024

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.

atsushieno avatar atsushieno commented on August 15, 2024

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.

pjcollins avatar pjcollins commented on August 15, 2024

Verified fixed in monodroid/d15-6/09b922fe.

from xamarin-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.