java - Two spinners change text in TextView -
I'm trying to create this Android app and I have some problems, I choose a card number in my left spinner I want to have a dealer hand in the right spinner, and I also take a card number there. (See image below)
I No problem can change my card and image updates, but when I select pre 17 and 2, how do I change the text in my text view? I have a TextView but have approved the text I tried to do it, but it is
if (plHand.equals ("8") and dlHand.equals (" 2 ") || dlHand.equals (" 3 ") {Toast. Make Text (this, "IT Work!", Toast. LNNHH_LOG). Show (); } I have made a toast to check when I have to. But nothing happens but how do I do it? plHand and dlHand is a string array I also tried if (sp1.getselectedItem (.) ToString (.) Equals ( "17") and (sp2) .getSelectedItem (.) Equal to ("Ace") {Toast Mac Text (main activity., "IT Works!", Toast.LnnHT_LOG) Show () ;} Hope people know what to do!
Edit: .. added more code
last String [] plHand = getResources () getStringArray (R.array.yourHand_array); last string [] dlHand = getResources () getStringArray (R.array.dealerHand_array); Final spinner SP1 = (spinner) findViewById (R.id.spinner1); Final spinner sp2 = (spinner) findViewById (R.id.spinner2); The text I want to change is also in string arrays, but I do not have to use string arrays, if there is any easy way!
Edit: It works now! Code is here!
itemprop = "text"> Just like the following, the same for both spinners OnItemSelectedListener Give Not: Adeptrwukontam Selektedlistr listener = new Ada pterView.OnItemSelectedListener () {@Override public items selected to zero (the adapter sequence & lt ;? & Gt; Parent, view view, integer position, long id) {string plHandText = sp1.getSelectedItem (). ToString (); String dlHandText = sp2.getSelectedItem (). ToString (); If ("17". Ammons (Ph & Ted) & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; 2; àijelals (DLH & Text) {Toast. Make Text (My Activity !, "This Works!", Toast, LNNHT_LOG). }} @ Override public zeros on any selection (adapterview & lt ;? & gt; parent) {}} sp1.setOnItemSelectedListener; sp2.setOnItemSelectedListener (listener); < / Div>
Comments
Post a Comment