Skip to content

Instantly share code, notes, and snippets.

@iseebi
Created May 8, 2013 03:56
Show Gist options
  • Save iseebi/5538072 to your computer and use it in GitHub Desktop.
Save iseebi/5538072 to your computer and use it in GitHub Desktop.
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Test01a
{
[Activity (Label = "Test01a", MainLauncher = true)]
public class Activity1 : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.MainContainer);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
class="TestApp01.MainFragment"
android:id="@+id/fragment1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace Test01a
{
public class MainFragment : Fragment
{
int count = 1;
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var rootView = inflater.Inflate(Resource.Layout.Main, container);
var button = rootView.FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
};
return button;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment