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

前端 未结 8 1136
花落未央
花落未央 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条回答
  •  情歌与酒
    2021-02-02 13:49

    You could always try the JavaCast<> method (most of the views implement this)(not tested):

    var message = list.SelectedItem.JavaCast< Message >();

提交回复
热议问题