On Apr 10, 2012, at 3:37 PM, Paul Johnson wrote:
> The bottom example is simple enough to port to C#, but I have a few questions.
>
> 1.
> private Method mMsgQueueNextMethod = null;
> private Field mMsgTargetFiled = null;
>
> By the looks of it mMsgQueueNextMethod is kind of like an Intent ore than
> anything. Not sure what Field equates to (var?)
Method and Field are from java.lang.reflect, and are not exposed in Mono for
Android. You'll need to use the JNI equivalents, JNIEnv.GetMethodID() and
JNIEnv.GetFieldID():
http://docs.xamarin.com/android/advanced_topics/Binding_Android_Types#_Instance_Methods
> 2.
> Class<?> clsMsgQueue = null;
> Class<?> clsMessage = null;
>
> By the looks Class<?> is roughly var - is it?
You can ignore the generic parameters; this is just a java.lang.Class, which is
bound as Java.Lang.Class or you can use JNIEnv.FindClass() if appropriate.
> 3. Can we do the likes of
>
> builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
AlertDialog.Builder.SetNegativeButton() has an overload which takes an
EventHandler:
http://androidapi.xamarin.com/?link=M%3aAndroid.App.AlertDialog%2bBuilder.SetNegativeButton(System.String%2cSystem.EventHandler%7bAndroid.Content.DialogClickEventArgs%7d)
allowing:
builder.SetNegativeButton("Cancel", (o, e) => {
mQuitModal = true;
mChoice = false;
dialog.Cancel();
});
Otherwise, you'd need to split that out into a separate class declaration:
class MyClickListener : Java.Lang.Object,
IDialogInterfaceOnClickListener {
public void OnClick (IDialogInterface dialog, int which) {...}
}
...
builder.SetNegativeButton("Cancel", new MyClickListener());
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid