Note that there are some explanatory texts on larger screens.

plurals
  1. POI want to make my toast pop up display something other than the spinner selections and fetch a download link
    primarykey
    data
    text
    <p>So I am pretty new to java and android coding. I have 2 spinners that, when an item is chosen in each and the submit button is pressed, I want the toast to pop up with "Selected (Rate/Rank) Fetching download" and actually be fetching the download.</p> <p>Here is the spinners xml:</p> <pre><code> &lt;Spinner android:id="@+id/rankspin" android:layout_below="@+id/textView2" android:layout_centerHorizontal="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:entries="@array/rate_array" android:prompt="@string/srate" /&gt; &lt;Spinner android:id="@+id/ratespin" android:layout_centerHorizontal="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/rankspin" android:layout_marginTop="20dp" android:entries="@array/rank_array" android:prompt="@string/srank" /&gt; &lt;Button android:id="@+id/sbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/ratespin" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:text="@string/button_label" /&gt; </code></pre> <p>Here are the arrays:</p> <pre><code>&lt;string name="srank"&gt;Select Rate:&lt;/string&gt; &lt;string name="srate"&gt;Select Rank:&lt;/string&gt; &lt;string name="button_label"&gt;Submit&lt;/string&gt; &lt;string-array name="rank_array"&gt; &lt;item&gt;Select Rank:&lt;/item&gt; &lt;item&gt;E-4&lt;/item&gt; &lt;item&gt;E-5&lt;/item&gt; &lt;item&gt;E-6&lt;/item&gt; &lt;item&gt;E-7&lt;/item&gt; &lt;item&gt;E-8&lt;/item&gt; &lt;item&gt;E-9&lt;/item&gt; &lt;/string-array&gt; &lt;string-array name="rate_array"&gt; &lt;item&gt;Select Rate:&lt;/item&gt; &lt;item&gt;ABE&lt;/item&gt; &lt;item&gt;ABH&lt;/item&gt; &lt;item&gt;CTI&lt;/item&gt; &lt;item&gt;CTM&lt;/item&gt; &lt;item&gt;CTN&lt;/item&gt; &lt;item&gt;CTR&lt;/item&gt; &lt;item&gt;CTT&lt;/item&gt; &lt;item&gt;YN&lt;/item&gt; &lt;/string-array&gt; </code></pre> <p>And finally the java:</p> <pre><code>public void addListenerOnSpinnerItemSelection() { spinner1 = (Spinner) findViewById(R.id.rankspin); spinner1.setOnItemSelectedListener(new MyOnItemSelectedListener()); } public void addListenerOnButton() { spinner1 = (Spinner) findViewById(R.id.rankspin); spinner2 = (Spinner) findViewById(R.id.ratespin); sbutton = (Button) findViewById(R.id.sbutton); sbutton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(Bibs.this, "Result : " + "\nSpinner 1 : "+ String.valueOf(spinner1.getSelectedItem()) + "\nSpinner 2 : "+ String.valueOf(spinner2.getSelectedItem()), Toast.LENGTH_SHORT).show(); } }); } </code></pre> <p>}</p> <p>The output im looking for is dependent on both inputs, a combination of rate and rank. For example and input of YN and E4 would result in YN3 as the output.</p> <p>Thank you in advance!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload