Created
May 13, 2017 13:22
Revisions
-
bigkiandi created this gist
May 13, 2017 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; namespace AutoComplete { [Activity(Label = "AutoComplete", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity { AutoCompleteTextView autocomplete1; Button btn_Submit; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); autocomplete1 = FindViewById<AutoCompleteTextView>(Resource.Id.autoComplete1); btn_Submit = FindViewById<Button>(Resource.Id.btn_Submit); var kota = new string[] { "Makassar", "Balikpapan", "Jakarta", "Jogja", "Surabaya", "Ambon", "Medan" }; ArrayAdapter adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerItem, kota); autocomplete1.Adapter = adapter; btn_Submit.Click += Btn_Submit_Click; } private void Btn_Submit_Click(object sender, EventArgs e) { if (autocomplete1.Text!="") { Toast.MakeText(this, "Kota dimasukkan =" + autocomplete1.Text, ToastLength.Short).Show(); } else { Toast.MakeText(this, "silahkan masukan nama kota dulu", ToastLength.Short).Show(); } } } }