I need an OnClickListener to my Spinner.
I tryed everything i found on the internet, but none of them worked. Please give me a solution for this:
Got my spinner here:
spinner = (Spinner)findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> 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());
And this is my_spinner.xml:
<?xml version="1.0" encoding="utf-8"?>
<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"
>
</TextView>
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.
I even tryed to add an invisible TextView atop of the Spinner, but then only one view can be sensored by OnClick.
Please help me guys.