android-spinner

Setting up Spinner filled with data without any reference to Android resources

馋奶兔 提交于 2019-12-13 08:07:01
问题 Busy creating an interface with spinner (dropdown) programmatically. To populate with data you need an (Array)Adapter. What I don't understand is why you need a reference to an Android resource at all, like "android.R.layout.simple_spinner_dropdown_item". Is it possible to populate the Spinner with webservice data, without any reference to such an Android resource? If not, why not and how should this resource look like, in an environment without layout's. If it is possible, please show me how

Passing Assigned Value of a Spinner from Fragment to Fragment within Viewpager NullPointerException

穿精又带淫゛_ 提交于 2019-12-13 07:36:38
问题 I've make it more simple and updated it based on the answers in my previous post: Adding Assigned Values in Spinner NullPointerException I have a MainAcitivty that uses a ViewPager . I have 2 Fragments in my MainActivity (FragA and FragB) In my FragA I have a spinner . While in FragB , I have a TextView and a Button . Now what am I trying to do is, when I select "Hello" in my spinner, my int a will have a value of 5. And when I click the Button, 5 will display in the TextView. Here's my code:

Can't load data properly from xml file to Spinner

一个人想着一个人 提交于 2019-12-13 07:05:23
问题 I have listgender.xml file like this: <gender> <sex>male</sex> <sex>female</sex> </gender> This is spinner_data.xml for spinner: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_spinner" android:textColor="#ff0004" android:textSize="14sp" xmlns:android="http://schemas.android.com/apk/res/android" /> This is ClassGender : public class ClassGender { private String sex; public String getSex() { return sex; } public void setSex(String sex) {

How to get the value of a selected item in a spinner?

孤街浪徒 提交于 2019-12-13 05:13:11
问题 I'm just learning Android app development, and I don't understand how to Log the value of a selected item from a spinner. Here's what I have for MainActivity.java import android.content.ContentResolver; import android.database.Cursor; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import

Spinner Values is not being selected

為{幸葍}努か 提交于 2019-12-13 04:47:00
问题 I have very simple spinnser in which i am showing two value 1=> English 2=> Hebrew and i restart the whole activity (To change UI) on selecting any value from the spinner but the problem is my activity is only restarting for case 1 only please help me to figure out the problem. Here is the code that i am using languageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (

Adding Assigned Values in Spinner NullPointerException

社会主义新天地 提交于 2019-12-13 04:38:22
问题 Like in my previous post: Adding Integers from Different Fragments in a ViewPager But now, I'm trying to assign a value in the spinner of FragA and add it to the int of FragB. Like the previous post, the sum will be on the FragC. Here's my code: FragA public class FragA extends Fragment{ Spinner spinner1; String s1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { spinner1 = (Spinner) getActivity().findViewById(R.id.spinner1);

spinner in android

别等时光非礼了梦想. 提交于 2019-12-13 03:53:38
问题 Hi I need to develop a spinner example in android. Here I have used below code: public class InsertionExample extends Activity { private final String NAMESPACE = "http://xcart.com"; private final String URL = "http://192.168.1.168:8089/XcartLogin/services/update?wsdl"; private final String SOAP_ACTION = "http://xcart.com/insertData"; private final String METHOD_NAME = "insertData"; Button btninsert; String selectedItem; static final String KEY_NAME = "orderid"; static final String KEY_STATUS

Spinner: getItemAtPosition(position) is returning always null/empty

谁说胖子不能爱 提交于 2019-12-13 03:48:31
问题 I wanted to display selected item in the textView when selected from dropdown list of spinner I implemented AdapterView.OnItemSelectedListener but when I'm selecting item its always null/empty here is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); spinner = (Spinner) findViewById(R.id.spinner); spinner.setAdapter(new CustomAdapter(MainActivity.this, Languages)); btn.setOnClickListener(this);

Filling data to spinner from firebase database

ぐ巨炮叔叔 提交于 2019-12-13 03:47:14
问题 My FireBase DataBase is like this: I want to get all the values from groupname as a String List or any form of list and use it to populate a Spinner. The problem I am getting is that it doesn't retrieve any value . This is my actual code: @Override protected void onStart() { super.onStart(); databaseGroups.child("Groups").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { final List<String> areas = new ArrayList<String>(); for

Custom spinner not showing dropdown in ActionBar icon

倖福魔咒の 提交于 2019-12-13 03:09:03
问题 Trying to get my custom Spinner with only an ImageView (to show a list of icon drawables) to work. I thought I had the custom adapter code correct, and the onCreateOptionsMenu() code correct, but no. The icon for the sharing feature shows in the ActionBar, but when I touch it, the Spinner does not dropdown the menu it should. What could be wrong? This goal is unique, because it is not just a custom spinner (easy to find tutorial on) or just an ActionBar icon placement (also easy), but rather