Skip to content

Instantly share code, notes, and snippets.

@angelobelchior
Created April 7, 2015 02:59
Show Gist options
  • Save angelobelchior/8ab924e9850a8ba84565 to your computer and use it in GitHub Desktop.
Save angelobelchior/8ab924e9850a8ba84565 to your computer and use it in GitHub Desktop.
namespace MyApp
{
[Activity (Label = "MyApp", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
var txtUser = FindViewById<EditText>(Resource.Id.txtUser);
var btnSearch = FindViewById<Button>(Resource.Id.btnSearch);
var lvwRepositories = FindViewById<ListView>(Resource.Id.lvwRepositories);
btnSearch.Click += async (object sender, EventArgs e) => {
var github = new Shared.GitHubApi();
var repositories = await github.GetAsync(txtUser.Text);
lvwRepositories.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItemSingleChoice, repositories);
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment