pratikbutani / MultiSelectSpinner

Android - Select Multiple Items from Spinner with Filtration.
http://pratikbutani.github.io/MultiSelectSpinner/
GNU General Public License v3.0
253 stars 125 forks source link

Must be my blunder ... #86

Closed tbbrightman closed 3 years ago

tbbrightman commented 3 years ago

I simply cannot import the MultiSelectSpinner-master project and build it successfully.

I am using Android Studio 4.1.3 on Linux (Ubuntu).

Starting Android Studio, I get the 'Welcome to Android Studio' screen and choose import project. I navigate to the local directory in which I have un-sipped MultiSelectSpinner-master.zip. Iopen it ro see: libreay, sample, and Gradle Scripts directories under Android in the MultiSelectSpinner-master project.

Under (Gradle Scripts) there are three build.gradle files. The first is called "build.gradle(Project: MultiSelectSpinner-master)". The second is called "build.gradle(Module:MultiSelectSpinner-master.library)". The third is called "build.gradle(Module:MultiSelectSpinner-master.sample)".

I assume the first is the 'root' build.gradle to which you refer in the instructions.

(This file already has the reference to 'maven' that you call for in your instructions.)

The 3rd file called "build.gradle(Module:MultiSelectSpinner-master.sample)" has a commented line that begins "implementation 'com.github.pratikbutani:..." I changed to :

"implementation 'com.github.pratikbutani:MultiSelectSpinner:f47c0dadea'"

When I then go to sample->java->com.androidbuts.sample->MainActivity and try a build it fails with: incompatible types: String cannot be converted to boolean. This seems due to the declaration of isSelected being incorrect. (String vs. boolean).

Making that change doesn't fix things.

I'm stuck. Please help.

pratikbutani commented 3 years ago

Have you written in project-level build.gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

By the way, the following dependency URL is working.

implementation 'com.github.pratikbutani:MultiSelectSpinner:f47c0dadea'

Check the updated example.

tbbrightman commented 3 years ago

Thank you for the speedy reply.

All is well now but I would report a bug: In Library->Java->com.androidbuts.multispinnerfilter->KeyPairBoolData.java you declare the method:

public KeyPairBoolData(String name, String isSelected){ this.name = name; this.isSelected = isSelected; }

It needs to be corrected to read

public KeyPairBoolData(String name, boolean isSelected){ this.name = name; this.isSelected = isSelected; }

After that, everything worked well.

If I were to guess, the Library version of KeyPairBoolData on your machine has that fix but the version in the Github released Library has the error.

Thanks!

On Tue, Apr 6, 2021 at 2:18 AM Pratik Butani @.***> wrote:

Have you written in project-level build.gradle

allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

By the way, the following dependency URL is working.

implementation 'com.github.pratikbutani:MultiSelectSpinner:f47c0dadea'

Check the updated example. https://github.com/pratikbutani/MultiSelectSpinner/blob/master/sample/build.gradle#L37

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pratikbutani/MultiSelectSpinner/issues/86#issuecomment-813854957, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDX257H2AFJ62XQ3X3VVLTHKRS5ANCNFSM42NOTVMQ .

-- Life is only a "zero-sum game" when you make it so.

tbbrightman commented 3 years ago

I hope I'm not being too troublesome but I'm having some very odd behavior with the MultiSelectSpinner.

(1) As a very deliberate engineer, I thought it would be prudent to slowly get familiar with your library. My first attempt to modify the sample app was to try to remove the SingleSpinnerSearch method. This has led to problems that I cannot understand.

As shown in the attached screenshot, multiselectspinner01.png, I trimmed activity_main.xml to remove the singlespinner fields.

Then I commented out the SingleSpinnerSearch singleSpinnerSearch; declaration and the code shown in multiselectspinner02.png.

Finally, I build and run the project and get the result shown in multiselectspinner03.png.

There is no change to the program result!?! What is going on?

This does not correspond to activity_main.xml or to MainActivity.java. What is happening?

(2) I also found something that looks very odd in MainDataBindingActivity.java. It has a line in it that reads:

private ActivityMainDataBindingBinding binding;

It seems like an error but I can't say for sure. The AndroidStudio editor shows red text everywhere it sees "ActivityMainDataBindingBinding" so I wanted to bring it to your attention.

Please let me know what you think of tese items.

Thanks, Tom B.

-- Life is only a "zero-sum game" when you make it so.

pratikbutani commented 3 years ago

Thank you for the speedy reply. All is well now but I would report a bug: In Library->Java->com.androidbuts.multispinnerfilter->KeyPairBoolData.java you declare the method: public KeyPairBoolData(String name, String isSelected){ this.name = name; this.isSelected = isSelected; } It needs to be corrected to read public KeyPairBoolData(String name, boolean isSelected){ this.name = name; this.isSelected = isSelected; } After that, everything worked well. If I were to guess, the Library version of KeyPairBoolData on your machine has that fix but the version in the Github released Library has the error. Thanks! On Tue, Apr 6, 2021 at 2:18 AM Pratik Butani @.**> wrote: Have you written in project-level build.gradle* allprojects { repositories { ... maven { url 'https://jitpack.io' } } } By the way, the following dependency URL is working. implementation 'com.github.pratikbutani:MultiSelectSpinner:f47c0dadea' Check the updated example. https://github.com/pratikbutani/MultiSelectSpinner/blob/master/sample/build.gradle#L37 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#86 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDX257H2AFJ62XQ3X3VVLTHKRS5ANCNFSM42NOTVMQ . -- Life is only a "zero-sum game" when you make it so.

Thank you for finding the issue. It's solved. Kindly check and do let me know.+ Thanks again.

pratikbutani commented 3 years ago

I hope I'm not being too troublesome but I'm having some very odd behavior with the MultiSelectSpinner. (1) As a very deliberate engineer, I thought it would be prudent to slowly get familiar with your library. My first attempt to modify the sample app was to try to remove the SingleSpinnerSearch method. This has led to problems that I cannot understand. As shown in the attached screenshot, multiselectspinner01.png, I trimmed activity_main.xml to remove the singlespinner fields. Then I commented out the SingleSpinnerSearch singleSpinnerSearch; declaration and the code shown in multiselectspinner02.png. Finally, I build and run the project and get the result shown in multiselectspinner03.png. There is no change to the program result!?! What is going on? This does not correspond to activity_main.xml or to MainActivity.java. What is happening? (2) I also found something that looks very odd in MainDataBindingActivity.java. It has a line in it that reads: private ActivityMainDataBindingBinding binding; It seems like an error but I can't say for sure. The AndroidStudio editor shows red text everywhere it sees "ActivityMainDataBindingBinding" so I wanted to bring it to your attention. Please let me know what you think of tese items. Thanks, Tom B. -- Life is only a "zero-sum game" when you make it so.

ActivityMainDataBindingBinding binding; is a binding concept. Maybe you don't know it. You can refer to the documentation for that.

Kindly check the latest example and try again.

pratikbutani commented 3 years ago

So finally I have released v1.0.1,

Kindly check that link for more information.

tbbrightman commented 3 years ago

This is very, very good!

I am now moving ahead to import the library into my app!

On Wed, Apr 7, 2021 at 3:02 AM Pratik Butani @.***> wrote:

So finally I have released v1.0.1 https://jitpack.io/#pratikbutani/MultiSelectSpinner/1.0.1,

Kindly check that link for more information.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pratikbutani/MultiSelectSpinner/issues/86#issuecomment-814658804, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDX22PWSLSCI3WZ2BJXLDTHP7PJANCNFSM42NOTVMQ .

-- Life is only a "zero-sum game" when you make it so.

sunnyAndroid commented 3 years ago

In multiserach spinner when I search something and click on ok then the application close by itself if I select item without search it works fine

tbbrightman commented 3 years ago

The multi select spinner is great!

I am working with it but I have one question for you: where do I get the xml definition of the spinner from?

Your sample activity.main uses a multiselectspinner in its Android Studio palette that I don't know how to find.

Again, great job and I'm almost off and running!

pratikbutani commented 3 years ago

Thank you so much for your appreciation.

You can check each and every class in the library folder.

pratikbutani commented 3 years ago

In multiserach spinner when I search something and click on ok then the application close by itself if I select item without search it works fine

I have checked again latest sample which I have uploaded is working very fine.

Kindly check the sample code again and do let me know if you get the problem.

tbbrightman commented 3 years ago

Since your project is so clean and powerful, I wanted to offer you a tutorial written by a native American English speaker that uses your app and Android Studio 4.1.3 to walk a newbie like me through its use.

This will be helpful for everyone frustrated by the spinner tutorials on the web. And they will have something much more useful when they're done!

-- Life is only a "zero-sum game" when you make it so.

pratikbutani commented 3 years ago

Yeah definitely. I will also add on my repo.

Thank you.

On Sat, Apr 10, 2021, 3:12 AM tbbrightman @.***> wrote:

Since your project is so clean and powerful, I wanted to offer you a tutorial written by a native American English speaker that uses your app and Android Studio 4.1.3 to walk a newbie like me through its use.

This will be helpful for everyone frustrated by the spinner tutorials on the web. And they will have something much more useful when they're done!

-- Life is only a "zero-sum game" when you make it so.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pratikbutani/MultiSelectSpinner/issues/86#issuecomment-816987482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZHG7SOEF54UQJBAMAXTXDTH5YFXANCNFSM42NOTVMQ .

tbbrightman commented 3 years ago

I am trying to use the MultiselectSpinner to implement a choose M of N possibilities app.

The code in MultiSpinnerSearch is way over my head but I can insert code into my app to interrogate the items array at its public void onItemsSelected(List items) {} method call to enforce the M of N selection rule when the user hits 'OK" on the app screen.

This is AFTER the user has selected more than allowed. Where can I insert code to prevent the user from checking more than M boxes?

I'm having a difficult time following the flow...where IS the 'OK' button in the XML?

-- Life is only a "zero-sum game" when you make it so.

pratikbutani commented 3 years ago

Have you checked setLimit method?

Check documentation or sample.

On Tue, Apr 13, 2021, 3:46 AM tbbrightman @.***> wrote:

I am trying to use the MultiselectSpinner to implement a choose M of N possibilities app.

The code in MultiSpinnerSearch is way over my head but I can insert code into my app to interrogate the items array at its public void onItemsSelected(List items) {} method call to enforce the M of N selection rule when the user hits 'OK" on the app screen.

This is AFTER the user has selected more than allowed. Where can I insert code to prevent the user from checking more than M boxes?

I'm having a difficult time following the flow...where IS the 'OK' button in the XML?

-- Life is only a "zero-sum game" when you make it so.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pratikbutani/MultiSelectSpinner/issues/86#issuecomment-818278705, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZHG7VKOHOR5YBIE6IELFLTINWNRANCNFSM42NOTVMQ .

tbbrightman commented 3 years ago

My app requires that I read the position number in the list of items when checked and that I prevent the user from checking any box that makes the total selected exceed a preset number, say N.

The difficulty is that I need to insert code into MultiSpinnerSearch.java to communicate expose certain variables to my app. This method is read-only and part of a remote library. I tried to bring it into my app various ways without success.

Can I simply 'clone' the libraries on my computer? I'm afraid I don't know how or if it's even the correct answer.

I'd be very grateful if you can help me out and send me a link or two.

-- Life is only a "zero-sum game" when you make it so.

pratikbutani commented 3 years ago

My app requires that I read the position number in the list of items when checked and that I prevent the user from checking any box that makes the total selected exceed a preset number, say N. The difficulty is that I need to insert code into MultiSpinnerSearch.java to communicate expose certain variables to my app. This method is read-only and part of a remote library. I tried to bring it into my app various ways without success. Can I simply 'clone' the libraries on my computer? I'm afraid I don't know how or if it's even the correct answer. I'd be very grateful if you can help me out and send me a link or two. -- Life is only a "zero-sum game" when you make it so.

You are open to use this by cloning library. You can change the code of library as you want.

Thank you

tbbrightman commented 3 years ago

Thank you for the kind reply.

I learned that a gitub repository can be 'clone'd, downloaded and imported into my app. I have done this with MultiselectSpinner and making changes successfully!

My apologies for my ignorance.

Thanks again.

On Sat, Apr 17, 2021 at 10:50 AM Pratik Butani @.***> wrote:

My app requires that I read the position number in the list of items when checked and that I prevent the user from checking any box that makes the total selected exceed a preset number, say N. The difficulty is that I need to insert code into MultiSpinnerSearch.java to communicate expose certain variables to my app. This method is read-only and part of a remote library. I tried to bring it into my app various ways without success. Can I simply 'clone' the libraries on my computer? I'm afraid I don't know how or if it's even the correct answer. I'd be very grateful if you can help me out and send me a link or two. … <#m6367151252060876059> -- Life is only a "zero-sum game" when you make it so.

You are open to use this by cloning library. You can change the code of library as you want.

Thank you

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pratikbutani/MultiSelectSpinner/issues/86#issuecomment-821834645, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDX25F4ESSMURF7ENCAC3TJGN4ZANCNFSM42NOTVMQ .

-- Life is only a "zero-sum game" when you make it so.

pratikbutani commented 3 years ago

Thank you for the kind reply. I learned that a gitub repository can be 'clone'd, downloaded and imported into my app. I have done this with MultiselectSpinner and making changes successfully! My apologies for my ignorance. Thanks again. On Sat, Apr 17, 2021 at 10:50 AM Pratik Butani @.***> wrote: My app requires that I read the position number in the list of items when checked and that I prevent the user from checking any box that makes the total selected exceed a preset number, say N. The difficulty is that I need to insert code into MultiSpinnerSearch.java to communicate expose certain variables to my app. This method is read-only and part of a remote library. I tried to bring it into my app various ways without success. Can I simply 'clone' the libraries on my computer? I'm afraid I don't know how or if it's even the correct answer. I'd be very grateful if you can help me out and send me a link or two. … <#m6367151252060876059> -- Life is only a "zero-sum game" when you make it so. You are open to use this by cloning library. You can change the code of library as you want. Thank you — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#86 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDX25F4ESSMURF7ENCAC3TJGN4ZANCNFSM42NOTVMQ . -- Life is only a "zero-sum game" when you make it so.

Lovely! Good Luck.

Rahul-Routh commented 1 year ago

not working in Android 13. Showing Error is

FATAL EXCEPTION: Thread-2 Process: com.exp.demo, PID: 28489 java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission. at android.os.Parcel.createExceptionOrNull(Parcel.java:3040) at android.os.Parcel.createException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:3007) at android.os.Parcel.readException(Parcel.java:2949) at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1294) at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1151) at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1180) at android.app.Instrumentation.sendKeySync(Instrumentation.java:1135) at android.app.Instrumentation.sendKeyDownUpSync(Instrumentation.java:1147) at com.androidbuts.multispinnerfilter.MultiSpinnerSearch.lambda$onCancel$0(MultiSpinnerSearch.java:185) at com.androidbuts.multispinnerfilter.MultiSpinnerSearch$$ExternalSyntheticLambda0.run(Unknown Source:0) at java.lang.Thread.run(Thread.java:1012) Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.input.InputManagerService.injectInputEventToTarget(InputManagerService.java:899) at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:617) at android.os.Binder.execTransactInternal(Binder.java:1326) at android.os.Binder.execTransact(Binder.java:1268)