Android Spinner: Get the selected item change event

Some of the previous answers are not correct. They work for other widgets and views, but the documentation for the Spinner widget clearly states: A spinner does not support item click events. Calling this method will raise an exception. Better use OnItemSelectedListener() instead: spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, … Read more

How to change spinner text size and text color?

Make a custom XML file for your spinner item. spinner_item.xml: Give your customized color and size to text in this file. <?xml version=”1.0″ encoding=”utf-8″?> <TextView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:textSize=”20sp” android:gravity=”left” android:textColor=”#FF0000″ android:padding=”5dip” /> Now use this file to show your spinner items like: ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list); You don’t need to set the … Read more

How to show loading spinner in jQuery?

There are a couple of ways. My preferred way is to attach a function to the ajaxStart/Stop events on the element itself. $(‘#loadingDiv’) .hide() // Hide it initially .ajaxStart(function() { $(this).show(); }) .ajaxStop(function() { $(this).hide(); }) ; The ajaxStart/Stop functions will fire whenever you do any Ajax calls. Update: As of jQuery 1.8, the documentation … Read more