How to populate Spinner from Database Android? -
I want to populate the spinner dropdown to show the list by calling the background thread. My code is not working.
ArrayAdapter & lt; Charsequence & gt; Adapter = new array adapter & lt; Foursmain & gt; (This, android.R.layout.simple_spinary_item); Adapter.setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item); Adapter.add (nameOfMethod (), item); Find ItemsPin = (Spinner) VibiBiID (RIDEtempin); Itemspin.setAdapter (adapter); Can anyone tell me what I am doing? Find VVBID (RID spinner); // Database Handler Database Scandaler DB = new database identifier (getApplicationContext ()); // Spinner drop-down list of elements & lt; String & gt; Lables = db.getAllLabels (); // Create Adapter for Spinner Array Adapter & lt; String & gt; DataAdapter = New Array Adapter & lt; String & gt; (This, android.R.layout.simple_spinner_item, lables); // Drop Down Layout Style - List view with the radio button data adapter .setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item); // Attach the data adapter to the spinner spinner .Setadapter (data adapter);
Comments
Post a Comment