Type cast from Java.Lang.Object to native CLR type in MonoDroid

前端 未结 8 1239
花落未央
花落未央 2021-02-02 13:38

How to cast Java.Lang.Object to some native type?

Example:

ListView adapter contains instances of native type Message. When i am trying to get SelectedItem from

8条回答
  •  Happy的楠姐
    2021-02-02 13:51

    The least magical way of getting a native type from the Spinner is to call

        message = ((ArrayAdapter)list.Adapter).GetItem(list.SelectedItemPosition);
    

提交回复
热议问题