Note that there are some explanatory texts on larger screens.

plurals
  1. POOnClickListener to Spinner ? ??
    text
    copied!<p>I need an OnClickListener to my Spinner.</p> <p>I tryed everything i found on the internet, but none of them worked. Please give me a solution for this:</p> <p>Got my spinner here:</p> <pre><code> spinner = (Spinner)findViewById(R.id.spinner1); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource (this, R.array.gyerekek_array, R.layout.my_spinner); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new ItemChooser()); </code></pre> <p>And this is my_spinner.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center_vertical|center_horizontal" android:textColor="#000000" android:paddingLeft="50dp" android:text="Sample Text" android:textStyle="bold" android:textSize="31sp" &gt; &lt;/TextView&gt; </code></pre> <p>I tryed everything from stackoverflow and everything else from the internet. I just cant make it... I cannot add onClickListener to the spinner's default TextView because i dont use the default spinner, i got my own my_spinner.xml. In Fact, if i add an "ID" to my Text View inside the my_spinner.xml i got a null pointer exception.</p> <p>I even tryed to add an invisible TextView atop of the Spinner, but then only one view can be sensored by OnClick.</p> <p>Please help me guys.</p>
 

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