thomashaertel / multispinner Goto Github PK
View Code? Open in Web Editor NEWAndroid Spinner Widget with multi selectable list
License: MIT License
Android Spinner Widget with multi selectable list
License: MIT License
How to use mutiple spiiners in one intent
When all options are selected then spinnerText gets displayed as blank, all values are not appended.
If we select all the elements in the spinner, It doesn't display the items on the boundary condition. Else it works fine (Y)
We have android.widget.Spinner in our project. Can MultiSpinner coexist with those widgets?
The error we get is "Error:(186) Attribute "spinnerStyle" has already been defined"
Any suggestions?
This is not spinner. This is Dialog..
I have set allText value but its null runtime.
There is a bug in logic:
MultiSpinner, line 197
someUnselected && !(mAllText != null && mAllText.length() > 0)
event if someUnselected is true, when mAllText is set the whole expression will evaluate to false and mAllText will be used
I see that the code in repository has new mAllSelectedDisplayMode property, but it is still broken when UseAllText is used.
I think the intention was for it to work like this:
someUnselected || mAllText == null || mAllText.length() == 0
Cheers,
Greg.
Self explanatory.
i have got cityBean type of class (that data is showing in spinner).now when i click on any item i want that item in listener ..how do i do it ..please help
private MultiSpinner.MultiSpinnerListener onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
public void onItemsSelected(boolean[] selected) {
// Do something here with the selected items
}
This is not opening any popup if I click on it , Just used it on API 24
by the last merge: Currently if all items are selected mAllText text is displayed instea… - that is a very good feature.
I can select the differents choices but when I valid by ok it answers me :
Attempt to invoke interface method 'void com.thomashaertel.widget.MultiSpinner$MultiSpinnerListener.onItemsSelected(boolean[])' on a null object reference at line 69 : "mListener.onItemsSelected(mSelected);"
In my app i've writen this in order to count the choices checked :
onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
public void onItemsSelected(boolean[] selected) {
// Do something here with the selected items
nombrechoix=0;
for (int i=1;i<=adapter.getCount();i++) {
if (selected[i - 1] = true) {
nombrechoix++;
}
}
question1b.setText(""+nombrechoix);
}
};
Please help me !
Thanks (sorry for my bad english)
Hello, I'm trying to show selected items.
@BindView(R.id.spDegree)
MultiSpinner spDegree;
String[] degreesList = degrees.split(",");
for (int i = 0; i < degreeModels.size(); i++) {
DegreeModel model = degreeModels.get(i);
for (int j = 0; j <; j++) {
if (degreesList[i].trim().equalsIgnoreCase(model.getTitle())) {
spDegree..setSelection(i);
}
}
}
But not able to show selected items
The dependency included in readme uses 0.1.0.
By default if nothing is selected, the spinner UI looks broken. Instead the spinner should display a hint text like "Choose a topic" when no item is selected.
Hi,
We have hit an issue with this widget when we select items and then call setAllText some times it does not set at all but if you open the MultiSelect again and click OK it then sets.
Setting up the Multi Select widget
engSpinner = (MultiSpinner) findViewById(R.id.engSpinner);
engSpinner.setAdapter(adapter, false, onSelectedListener);
The code below on the first run selecting all items it shows the engineers in the toast message but not on the text field of the multi Select.
private MultiSpinner.MultiSpinnerListener onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
public void onItemsSelected(boolean[] selected) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < selected.length; i++) {
if (selected[i]) {
builder.append(adapter.getItem(i)).append(" ");
}
}
Toast.makeText(getApplicationContext(), builder.toString(), Toast.LENGTH_SHORT).show();
engSpinner.setAllText(builder.toString());
}
};
Any help would be much appreciated it appears to be that just calling engSpinner.setAllText requires the refresh method to be called perhaps?
Hi there, I'm having some trouble adding this into my Android Studio app. When I add into my compile dependencies it returns an error upon gradle sync. I tried following the install instructions included, but no go. Can you help?
Error:(26, 13) Failed to resolve: com.thomashaertel:multispinner:0.1.0
Show in File
Show in Project Structure dialog
I have a use case where I start a background Service and then draw an overlay over the current screen (always on top) by using:
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
windowManager.addView(myView, params)
I've added the spinner on myView and it displays correctly, but when I click it I get this Exception:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRootImpl.setView(ViewRootImpl.java:536) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at android.app.Dialog.show(Dialog.java:286)
Exception is nothing specific to this component, it happens when you try the draw a Dialog on any overlay screen.
I've fixed it by adding this permission to the app (android.permission.SYSTEM_ALERT_WINDOW) and by modifying the code of MultiSpinner, adding this in the OnClickListener.onClick():
AlertDialog dialog = builder.create(); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.show();
I suggest adding a flag to MultiSpinner to support displaying a dialog in this way.
Hi, I tried to add your multiSpinner to my project but it's has been imposible. I use Gradle with maven and If I code what you say on readme I obtain this error:
Error:(59, 13) Failed to resolve: com.thomashaertel:multispinner:0.1.0
I tried too many things, but nothing works.
Hi,
as soon as every entry in the multispinner is selected, that is no longer shown in the spinner itself.
I worked around that with a listener for now.
The problem is that "someUnselected" is false if everything is selected, see line 167 class MultiSpinner in version 0.1.1:
if (someUnselected && !(mAllText != null && mAllText.length() > 0)) { spinnerText = spinnerBuffer.toString(); if (spinnerText.length() > 2) spinnerText = spinnerText.substring(0, spinnerText.length() - 2); } else { spinnerText = mAllText; }
Cheers
hei thanks fro giving this for open source can you please explain me how to add select all option
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.