Android spinner : perform item selected and and compare it to another spinner
By : David Goularte
Date : March 29 2020, 07:55 AM
|
Android: Trying to create a spinner with items based on another spinner's item selected
By : Sourav Biswas Shavon
Date : March 29 2020, 07:55 AM
Any of those help I have a spinner with items mg, g, micrograms, kg. If I select mg, I want the 2nd spinner updated with mg and g items only. But when the use the if logic I get " The method createFromResource(Context, int, int) in the type ArrayAdapter is not applicable for the argume" error. , Your problem is on this line: code :
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.units, android.R.layout.simple_spinner_item);
|
Android Spinner will not launch OnItemSelected and current selected item is not displayed in Spinner
By : user3433247
Date : March 29 2020, 07:55 AM
will help you Finally came across this which helped me, I changed my InitialSetupUI function to this: code :
public void uniSpinnerSetup()
{
ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery create() {
ParseQuery query = new ParseQuery("University");
return query;
}
};
uniSpinner = (Spinner) findViewById(R.id.uniSpinner);
ParseQueryAdapter<ParseObject> adapter = new ParseQueryAdapter<ParseObject>(this, factory);
adapter.setTextKey("name");
uniSpinner.setAdapter(adapter);
uniSpinner.setSelection(1);
uniSpinner.setOnItemSelectedListener(new mySpinnerListener());
}
|
android spinner if some item selected, other spinner gone
By : Lean FK
Date : March 29 2020, 07:55 AM
should help you out You forgot to retrieve the currently selected item of your spinner & save it to your spinner1x string, & to implement the onNothingSelected method: code :
spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> mRelative, View selectedItemView, int position, long id) {
spinner1x = mRelative.getItemAtPosition(position).toString();
// your code here
if (spinner1x.equals("poison")){
spinner2.setVisibility(View.VISIBLE);
spinner3.setVisibility(View.GONE);
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
// Another interface callback
}
});
|
how to get values from selected item spinner (Android Studio to Firebase)
By : jeffbhamilton
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , First of all, thankyou for clicking my question, hope you can help me to resolve my problem here :( , Your reference is at the root node: code :
mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.child("PRODUCTS").child("PROD1").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
selectedproductprice = dataSnapshot.child("productprice").getValue().toString();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
|