Category : spinner

I have a SearchableSpinner and I want to display the text in the center of it <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <com.toptoche.searchablespinnerlibrary.SearchableSpinner android:id="@+id/spinner_client" style="@style/spinner_style_v2" android:layout_width="300dp" android:layout_height="wrap_content" android:padding="5dp" android:drawSelectorOnTop="true"/> </LinearLayout> and here the custom style. I tried adding <item name="android:textAlignment">center</item> but it’s not working also I’ve tried <item name="android:paddingTop">10dp</item> to see if the text will move to ..

Read more

I am programming a small game app in with every player get’s to choose a drawable which is then set for the following activity which is the small game. This is my code so far. public class Nameeingabespieler2 extends AppCompatActivity { public static final String EXTRA_NAME1 = "com.example.die_trinkspielapp.EXTRA_NAME1"; public static final String EXTRA_NAME2 = "com.example.die_trinkspielapp.EXTRA_NAME2"; ..

Read more

**so guys i am trying to implement the onItem selected to my spinner. The data is retrived from the firebase and added to the arraylist and that array list i added to the adatper //spinner stufff //variables: Spinner schoolNamesSpinner; DatabaseReference databaseReference; ArrayList<String> instituteNames; ArrayAdapter<String> adapter; adapter = new ArrayAdapter<>(studentsLogIn.this, android.R.layout.simple_spinner_dropdown_item, instituteNames); schoolNamesSpinner.setAdapter(adapter); adapter.notifyDataSetChanged(); **// populating ..

Read more

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //This Spinner is not located in the MainActivity but in A fragment Spinner s = (Spinner) findViewById(R.id.spinner33); s.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String msupplier=s.getSelectedItem().toString(); Log.e("Selected item : ", msupplier); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); ..

Read more

So basically the title says it. I am going to try and put the code in and it would be nice if i could get an answer. SecondFragment. override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_second, container, false) } override fun onViewCreated(view: ..

Read more

I am trying to populate a spinner with data from an API. However, when I try to open the spinner it is giving met the following error: Android Accessing hidden field Landroid/widget/AbsListView;->mIsChildViewEnabled:Z (greylist, reflection, allowed) I put the spinner inside a fragment and I use this fragment inside my main_activity: import android.os.Bundle; import androidx.fragment.app.Fragment; import ..

Read more

Here is a function that is called to display data in a spinner. This is the response I get. Reponse: Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘retrofit2.Call co.ke.smartcare.apiutilities.ApiService.fetchDocs()’ on a null object reference Function: public void fetchDoctors(){ apiService.fetchDocs().enqueue(new Callback<List<Doctor>>() { @Override public void onResponse( Call<List<Doctor>> call, Response<List<Doctor>> response ) { List<Doctor> doctors = ..

Read more