miteshpithadiya / searchablespinner Goto Github PK
View Code? Open in Web Editor NEWSpinner with searchable items.
Spinner with searchable items.
Hello, first for all, sorry for my bad English.
Ok, straight to the point. The type of my adapter for the spinner is a project class (e.g. ArrayAdapter), witch contains two attributes, id (int) and name (String). So I implemented a subclass of ArrayAdapter for a custom filter, because the default filter isn't useful for me, since in my native language (Spanish), there are words with special characters and the filter only works when the text to search matches the beginning of the word.
I've been researched your source code and I realized that ListAdapter for inner ListView of search dialog is built with a generic ArrayAdapter created from the List of items of Dialog class. This causes the filter of my custom Adapter not recognized and the adapter tooks the default instead.
I wish that ListAdapter of inner ListView is created from the custom Adapter in the method setAdapter
of class SearchableSpinner
I wait for your early reply. I'd be really useful for me.
Thanks.
In my case, I just open Overview Screen ("Recent Apps") while I have the SearchableSpinner dialog box open in an activity. As soon as the OnPause() is called, the app crashes. 100% reproducible.
Exception logcat:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
The listview isn`t refreshed when you set a new adapter.
Hi ,
I am trying to implement this feature but searchable spinner is not supporting it.
https://android--code.blogspot.in/2015/08/android-spinner-disable-item.html
could you please resolve this.
Hello,
I would like to mention another thing related to searchable spinner.
Please note that , if you use this spinner in a scroll view or scroll-able layout with lot of other fields in a layout then it will be automatically called/invoked which will lead towards Bad User Experience , Kindly have a look at that to Fix this nicely managed spinner.
Appreciated your support as always.
Kind Regards,
Abid
Fatal Exception: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
at android.os.Parcel.writeSerializable(Parcel.java:1399)
at android.os.Parcel.writeValue(Parcel.java:1346)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:649)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
at android.os.Bundle.writeToParcel(Bundle.java:1034)
at android.os.Parcel.writeBundle(Parcel.java:674)
at android.app.FragmentState.writeToParcel(Fragment.java:144)
at android.os.Parcel.writeTypedArray(Parcel.java:1202)
at android.app.FragmentManagerState.writeToParcel(FragmentManager.java:381)
at android.os.Parcel.writeParcelable(Parcel.java:1368)
at android.os.Parcel.writeValue(Parcel.java:1273)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:649)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
at android.os.Bundle.writeToParcel(Bundle.java:1034)
at android.os.Parcel.writeBundle(Parcel.java:674)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3031)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3569)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5653)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by java.io.NotSerializableException: android.widget.ArrayAdapter
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1344)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
at android.os.Parcel.writeSerializable(Parcel.java:1394)
at android.os.Parcel.writeValue(Parcel.java:1346)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:649)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
at android.os.Bundle.writeToParcel(Bundle.java:1034)
at android.os.Parcel.writeBundle(Parcel.java:674)
at android.app.FragmentState.writeToParcel(Fragment.java:144)
at android.os.Parcel.writeTypedArray(Parcel.java:1202)
at android.app.FragmentManagerState.writeToParcel(FragmentManager.java:381)
at android.os.Parcel.writeParcelable(Parcel.java:1368)
at android.os.Parcel.writeValue(Parcel.java:1273)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:649)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
at android.os.Bundle.writeToParcel(Bundle.java:1034)
at android.os.Parcel.writeBundle(Parcel.java:674)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3031)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3569)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5653)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755
Hi,
There is only default adapter used in the custom spinner, why dont we use the custom adapter with defined object and resource. (eg. Custom array object, arraylist etc...)
Hello , I am using Database where i Have Five Columns in the Table . That Table Headers are
"Emp ID, Emp Name , Emp Add, Emp City, Emp Phone" From All This Columns I want to Only Show the details of "Emp City" in the spinner. Please Help me with Code How i it will work and how i can achieve it ?
Hi bro.
this is an awesome lib. can u add hint feature to spinner?
sometimes its better than the default selection
hi . how to change typeface of items ?
Is there any way to change the title and close button text in the dialog spinner for multilanguage support?
Fatal Exception: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
Hi there,
could you add a method to check if the fragment is already added? This is a small issue, but it can be handled easy.
I'm getting this error, on fast double click...
java.lang.IllegalStateException: Fragment already added: SearchableListDialog{10fe7cc4 #0 TAG}
First Thank u some for this good library.please help me customize your library in programmatically like
SearchableSpinner.getResources().getStringArray(R.array.XXXXX);
Hi,
First thanks for this library. Is there any way to hide black text bar upon the dialog interface which pops up while typing to seachview?
When we select any value from the spinner the selected value should be displayed in the Edit Text ?
How it work ??
I can't figure out a good way to do this, but if I have a SearchableSpinner with a hint, then I use it to select an item (and then do things in my on selected) I'd like to be able to clear the selected item and return to displaying the hint.
when i add a background to spinner , it disappears.
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="@+id/spinner"
android:layout_width=wrap_content"
android:layout_height="wrap_content"
android:entries="@array/planets"
android:background="@color/colorAccent"
app:hintText="SEKECCTTT"/>
Hi Mitesh,
On multiple times click on spinner the app crash.
In SearchableSpinner.java line number 91 change _searchableListDialog.show(scanForActivity(_context).getFragmentManager(), "TAG"); code to
if(!_searchableListDialog.isAdded()) {
_searchableListDialog.show(scanForActivity(_context).getFragmentManager(), "TAG");
}
When I click the SearchableSinner throw Exception
java.lang.IllegalStateException: Fragment already added: SearchableListDialog{ad4f6610 #0 TAG}
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1133)
at android.app.BackStackRecord.run(BackStackRecord.java:618)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Assume I have 2 texts inside the spinner: "Good Morning"
and "Hello World"
.
When I search with starting 'g' it works right. but when I search with starting 'w' it doesn't show anything. Am I wrong or all of you have this problem?
Sorry for bad English :)
Cannot differentiate between real value and hint.
How to set different color for hint?
when i do performClick on spinner it doens't show the dialog but opens the normal spinner, the dialog cannot be retrieved in no way from the SearchableSpinner.java class, there is a possibility to provide a method getDialog() for operating on this object ?
I would like to change color of text in the list and in the title
The only type of adaptor we can use is Array adaptor, can you make it Spinner Adaptor.
I get this error when trying to filter the spinner.
An exception occured during performFiltering()!
java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created.
And this one
java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
I'm using realm database and ArrayAdapter. I hope this error gets resolved soon.
Hi
Firstly thanks for a useful library...
Can you please help me out in how can i customize the colors or style for alert dialog popup if its not possible can you please add the functionality to provide for the same
Thanks
Hello Mitesh Pithadiya,
I hope you are doing great, I am using your searchable spinner in my project , I have a requirement to send selected item's/Value's Key to the server because in my case spinner will be populated with a service call that will have key and value pairs as a data, I have decided to use a Map like this to hold key and value. for Exaample
Private LinkedHashMap<String, String> mapData = new LinkedHashMap<String, String>();
mapData.put("shamu", "Nexus 6");
.
.
.
.
and so on .
and mapData will be used in spinner adapter.
My concern is to have this support in searchable spinner if possible or may be another version of spinner to incorporate this functionality. or if you have any other suggestions to incorporate this problem pleas let me know.
Kindly acknowledge,
Muhammad Abid
Your libraries is very cool but without sample, it's more complicated for use it
thx
I am using a custom adapter which extends ArrayAdapter and overrides both getDropDownView and getView. My intention is to change the layout of items ONLY when they are displayed in the dropdown menu, however, it seems that only getView is triggered, and not getDropDownView.
Is this by any chance an issue with SearchableSpinner?
Hello,
I was using your library in my project. After opening the spinner my phone got locked and on console "java.io.NotSerializableException: in searchable spinner" this error was printed and my appilication was crashed.
Can you please solve this issue asap.
force close app when double click on searchable spinner
I'm using v. 1.3.1 while the spinner is opened and I click on Home button or Overview button, the app crashes. The following error showed up:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
Thanks for this great library.
Hello,
I implemented this library in my project but when i type any query in searchview of the dialog box, Its getting printed above the search view in an transparent layout i tried to find out the issue but i got nothing.
Can you tell me how to remove that transparent layout.
I have used SearchableSpinner in a fragment . It return the selected item value but does not set to spinner
Also used onSearchableItemClicked method explicitly but its not working . I guess setSelection method not working
Setselection(int position) is an important functionality, and its not working. Please make this enhancement.
When I open the search spinner and click on "back press" on my phone I have an io serializable exception ... Please help me to fix it ๐
When dialg is opened and orientation is changed after clicking on item its getting crashed i think there is an issue with the interface.
Hi,
I would like to set the title in the layout because I am loading data strings.XML using android:entries="@array hence i would like to understand how doi set title to this spinner in layout
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.