protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.FindContactResults); listWrapper = FindViewById<LinearLayout>(Resource.Id.linearResultsWrapper); ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack); Button btnDone = FindViewById<Button>(Resource.Id.btnDone); context = listWrapper.Context; TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader); RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, header.Context); Header.headertext = Application.Context.Resources.GetString(Resource.String.findContactbtnSearch); Header.fontsize = 36f; ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; db = wowZapp.LaffOutOut.Singleton.dbm; contacts = FindContactResultsUtil.contacts; profilePicsGrabIndex = 0; profilePicsToBeGrabbed = new List<Guid>(); LinearLayout bottomHolder = FindViewById<LinearLayout>(Resource.Id.bottomHolder); //xSize = (int)ImageHelper.convertDpToPixel (40f, context); //ySize = xSize; btnBack.Click += delegate { Finish(); }; btnDone.Click += delegate { Finish(); }; ImageHelper.setupButtonsPosition(btnBack, btnDone, bottomHolder, context, true); newSizes = new float[2]; newSizes [0] = newSizes [1] = 40f; newSizes = ImageHelper.getNewSizes(newSizes, context); for (int n = 0; n < contacts.Count; n++) { LinearLayout layout = new LinearLayout(context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity(GravityFlags.Center); layout.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), (int)ImageHelper.convertDpToPixel(10f, context)); ImageView profilepic = new ImageView(context); profilepic.LayoutParameters = new ViewGroup.LayoutParams((int)newSizes [0], (int)newSizes [1]); profilepic.Tag = new Java.Lang.String("profilepic_" + contacts [n].ContactAccountID.ToString()); if (Contacts.ContactsUtil.contactFilenames.Contains(contacts [n].ContactAccountID.ToString())) { using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, contacts [n].ContactAccountID.ToString ()))) { using (MemoryStream ms = new MemoryStream ()) { bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] image = ms.ToArray(); displayImage(image, profilepic); } } } else { if (contacts [n].ContactUser.Picture.Length > 0) { profilePicsToBeGrabbed.Add(contacts [n].ContactAccountID); } else { profilepic.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.defaultuserimage)); } } layout.AddView(profilepic); using (TextView text = new TextView (context)) { text.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(235f, context), (int)ImageHelper.convertDpToPixel(40f, context)); text.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0); text.Gravity = GravityFlags.CenterVertical; text.TextSize = 16f; text.SetTextColor(Android.Graphics.Color.White); if (contacts [n].ContactUser.FirstName != "" || contacts [n].ContactUser.LastName != "") { text.Text = contacts [n].ContactUser.FirstName + " " + contacts [n].ContactUser.LastName; } else { text.Text = contacts [n].ContactUser.EmailAddress; } layout.AddView(text); } ImageView checkbox = new ImageView(context); checkbox.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(25f, context), (int)ImageHelper.convertDpToPixel(25f, context)); if (db.CheckContactExistsForOwner(contacts [n].ContactAccountID.ToString(), AndroidData.CurrentUser.AccountID.ToString()) == true) { checkbox.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.@checkedbox)); checkbox.ContentDescription = ADD_DISABLED; } else { checkbox.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.add)); checkbox.ContentDescription = ADD_ENABLED; } int contactId = new int(); contactId = n; layout.Clickable = true; layout.Click += delegate { AddContact(checkbox, contactId); }; layout.AddView(checkbox); this.listWrapper.AddView(layout); } if (profilePicsToBeGrabbed.Count > 0) { profilePicsGrabIndex = 0; LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [0], new Guid(AndroidData.ServiceAuthToken)); } }