1 rating
  • 1
  • 2
  • 3
  • 4
  • 5
5 star 1
4 star 0
3 star 0
2 star 0
1 star 0
Compatible with
  • Android

Genetics for Xamarin.Android

Xamarin Inc

An attribute-based injection of Android resources, views and event handlers.

Genetics allows attributes to be used to describe how to inject resources, views and events into an object. Based on the resource ID provided, it can inject the appropriate Android View or Android resource. Or, it can automatically attach event handlers to View events.

  • Use [Splice] on fields and properties instead of FindViewById method calls.
  • Use [Splice] on fields and properties instead of GetString or GetDrawable method calls.
  • Use [SpliceEvent], or others like [SpliceClick], on methods instead of attaching delegates to events.
public class MyActivity : Activity
  private EditText username;
  private EditText password;
  private string loginErrorMessage;

  private void LoginClicked(object sender, EventArgs e)
    // TODO: perform login...

  protected override void OnCreate(Bundle savedInstanceState)

    // load the view layout
    // inject the views

    // TODO: use fields...

  protected override void OnDestroy()
    // dispose of events and resources


Release Notes

Version 1.1.0

  • This release changes few things, but should not affect typical usage:
    • More XML docs
    • Support for multiple events to a single method
  • Corrected the handling of missing events/null views:
    • if a member is optional, then log
    • if a member is required, then throw
    • if source is null, then skip event splicing
    • if source is unknown, then throw

Version 1.0.0

  • Initial release
Be the first to write a review