Well, I created two Activity's when I clicked on the first button and it should open the second with information received from the first one. But is not that what happens, where did I go wrong?
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
//Atividade Principal
namespace TabelaPeriodica
{
[Activity (Label = "TabelaPeriodica", 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);
// Get our button from the layout resource,
// and attach an event to it
EditText edt = FindViewById<EditText> (Resource.Id.edtsmb);
Button bttn = FindViewById<Button> (Resource.Id.env);
if (!string.IsNullOrEmpty(edt.Text))
{
bttn.Click += delegate {
var ress = new Intent (this, typeof(Result));
ress.PutExtra ("simbol", edt.Text);
StartActivity (ress);
};
}
}
}
}
Second Activity:
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.Views;
using Android.Widget;
namespace TabelaPeriodica
{
[Activity (Label = "Result")]
public class Result : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Create your application here
SetContentView (Resource.Layout.Result);
TextView sm = FindViewById<TextView> (Resource.Id.tsimb);
sm.Text = Intent.GetStringExtra ("simbol") ?? "Erro";
}
}
}