protected override void OnRestart() { cusAdapter.GetData().Clear(); SearchFunc(); lvResult.Adapter = cusAdapter; base.OnRestart(); }
//ImageView backgroundImg; //Bitmap bitmapToDisplay; protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.BookMarkResult); if (MainActivity.Activities.ContainsKey("BookmarkActivity")) { MainActivity.Activities["BookmarkActivity"].Finish(); MainActivity.Activities.Remove("BookmarkActivity"); MainActivity.Activities.Add("BookmarkActivity", this); } else { MainActivity.Activities.Add("BookmarkActivity", this); } // Create your application here //backgroundImg = FindViewById<ImageView>(Resource.Id.backgroundImg); //BitmapResize br = new BitmapResize(); //BitmapFactory.Options options = await br.GetBitmapOptionsOfImageAsync(Resources, Resource.Drawable.MainImage2); //bitmapToDisplay = await br.LoadScaledDownBitmapForDisplayAsync(Resources, Resource.Drawable.MainImage2, options, 50, 50); //backgroundImg.SetImageBitmap(bitmapToDisplay); tempShopList = new List <ShopInformation>(); lvResult = FindViewById <ListView>(Resource.Id.LV_SEARCHRESULT); cusAdapter = new CustomListAdapter(this.ApplicationContext, tempShopList); cusAdapter.GetData().Clear(); SearchFunc(); lvResult.Adapter = cusAdapter; lvResult.ItemClick += LvResult_ItemClick; RegisterForContextMenu(lvResult); }
public override bool OnContextItemSelected(IMenuItem item) { switch (item.ItemId) { case 1: { ShopInformation selectShop = cusAdapter.GetData()[itemPostion]; foreach (var i in Data_ShopInfo.DIC_SHOP_XML_INFO_OVERALL_INFO) { if (i.Key.Equals(selectShop.IdentificationNumber)) { var next = new Intent(this.ApplicationContext, typeof(UnderShopMapActivity)); next.PutExtra("Local", selectShop.Local); next.PutExtra("SHOP_ID_NUMBER", selectShop.IdentificationNumber); StartActivity(next); } } break; } case 2: { ShopInformation selectShop = cusAdapter.GetData()[itemPostion]; foreach (var i in Data_ShopInfo.DIC_SHOP_XML_INFO_OVERALL_INFO) { if (i.Key.Equals(selectShop.IdentificationNumber)) { var next = new Intent(this.ApplicationContext, typeof(ShopInfoActivity)); next.PutExtra("SHOP_ID_NUMBER", selectShop.IdentificationNumber); next.PutExtra("Local", selectShop.Local); StartActivity(next); } } break; } } return(base.OnContextItemSelected(item)); }
//private Bitmap bitmapToDisplay; protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.SearchResult); if (MainActivity.Activities.ContainsKey("SearchResultActivity")) { MainActivity.Activities["SearchResultActivity"].Finish(); MainActivity.Activities.Remove("SearchResultActivity"); MainActivity.Activities.Add("SearchResultActivity", this); } else { MainActivity.Activities.Add("SearchResultActivity", this); } tempShopList = new List <ShopInformation>(); string mSearchString = Intent.GetStringExtra("searchString"); //backgroundImg = FindViewById<ImageView>(Resource.Id.backgroundImg); //BitmapResize br = new BitmapResize(); //BitmapFactory.Options options = await br.GetBitmapOptionsOfImageAsync(Resources, Resource.Drawable.MainImage2); //bitmapToDisplay = await br.LoadScaledDownBitmapForDisplayAsync(Resources, Resource.Drawable.MainImage2, options, 50, 50); //backgroundImg.SetImageBitmap(bitmapToDisplay); lvResult = FindViewById <ListView>(Resource.Id.LV_SEARCHRESULT); et = FindViewById <EditText>(Resource.Id.EDT_RESEARCH); Button bt = FindViewById <Button>(Resource.Id.BTN_RESEARCH); et.Text = mSearchString; cusAdapter = new CustomListAdapter(this.ApplicationContext, tempShopList); cusAdapter.GetData().Clear(); lvResult.Adapter = cusAdapter; if (mSearchString != null) { SearchFunc(mSearchString); } bt.Click += new EventHandler(OnResearchClick); lvResult.ItemClick += LvResult_ItemClick; RegisterForContextMenu(lvResult); }