コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_places_autocomplete);

            // Get our button from the layout resource,
            // and attach an event to it
            mAutocomplete = FindViewById <PlacesAutocompleteTextView>(Resource.Id.autocomplete);
            mStreet       = FindViewById <TextView>(Resource.Id.street);
            mCity         = FindViewById <TextView>(Resource.Id.city);
            mState        = FindViewById <TextView>(Resource.Id.state);
            mZip          = FindViewById <TextView>(Resource.Id.zip);

            mAutocomplete.SetOnPlaceSelectedListener(this);
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.StartPage);
            Name          = FindViewById <EditText>(Resource.Id.name);
            Mobile        = FindViewById <EditText>(Resource.Id.number);
            start         = FindViewById <Button>(Resource.Id.start);
            mAutoComplete = FindViewById <PlacesAutocompleteTextView>(Resource.Id.autocomplete);
            mAutoComplete.SetOnPlaceSelectedListener(this);
            start.Click += async delegate
            {
                UserData user = new UserData
                {
                    name         = Name.Text.ToString(),
                    phone        = Mobile.Text.ToString(),
                    locationName = Settings.City,
                    latitude     = "11.25",
                    longitude    = "75.78"
                };
                string body = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(user));

                var result = await LoginService.Login(body);

                if (result.status == "UA100")
                {
                    Toast.MakeText(this, "User Added", ToastLength.Short).Show();
                    var intent = new Intent(this, typeof(HomeActivity));
                    StartActivity(intent);
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, "Sorry,Cant Login!", ToastLength.Short).Show();
                }
            };
        }