Hi,

i.PutExtra("ID", ids [0]) will store a string, since your IDs
are stored in a string list.

int f = base.Intent.GetIntExtra("ID", 0) is trying to read
an int, but, obviously, it can't find one because you've
stored a string.

Robert


On 09.04.2013 02:35, Paul Johnson wrote:
Hi,

I'm using Xamarin.Android 4.6.2 and have found a problem not in 4.6.1

My code to call a new activity looks like this

btnView.Click += delegate
             {
                 List<string> ids = recsToView.Select(t =>
t.ToString()).ToList();
                 Intent i = new Intent(this, typeof(infoRecord));
                 i.PutExtra("list", ids.Count > 1 ? true : false);
                 i.PutExtra("sex", baseInfo.sex);
                 i.PutStringArrayListExtra("IDs", ids);
                 if (ids.Count == 1)
                     i.PutExtra("ID", ids [0]);
                 StartActivity(i);
             };

Nothing out of the ordinary. If I put a debug point at the
startactivity, the intent has everything in there correctly.

The receiving activity looks like this

bool isList = base.Intent.GetBooleanExtra("list", false);
baseInfo.sex = base.Intent.GetBooleanExtra("sex", true); // male
baseInfo.ID = base.Intent.GetIntExtra("ID", -1);
int f = base.Intent.GetIntExtra("ID", 0); // test
bool all = base.Intent.GetBooleanExtra("all", false);

Again, a breakpoint shows {ID=6445, sex=false, list=false, IDs={6445}},
so the values are there and showing correctly, they're just not being
read into the variables.

Any ideas on what is going on here or if it's a bug I've found?

Paul

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to