[mono-android] [Monodroid] switching views (again)
John Murray
john at murray.gb.com
Sat Mar 19 09:19:54 EDT 2011
I know this has been discussed before - most recently the main point being
one shouldn't just switch views but switch activities
I have been experimenting aiming to have a simple modal data entry dialog
Haven't found out how to do it with dialogs as they seem to be restricted to
a list or date or time picker (I presume I should be able to create my own
custom dialog )
But I just don't understand why one cannot do this
[Activity(Label = "monodlgtest1", MainLauncher = true)]
public class Activity1 : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { bclick();}
Button buttonback = FindViewById<Button>(Resource.Id.goBack);
buttonback.Click += delegate { bclick2(); };
SetContentView(Resource.Layout.Main);
}
The button clicks simply set the alternate view
Is this a) valid and b) kosher (think I know the answer to the latter)
Anyway my VS2010 and emulator just hangs when trying to find the second
gBack button which is on a different layout
Must have missed something there
I have read through the fundamentals but being a beginner here it doesn't
always make sense to me
Can someone explain
a) Why the above code doesn't work
b) How one creates matching activities to each view (I presume that
would solve the problem)
c) Is there a better way of creating a modal data entry dialog
Many thanks in advance
John Murray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110319/b4c14438/attachment-0001.html
More information about the Monodroid
mailing list