hannesa2 / paho.mqtt.android

Kotlin MQTT client for Android
432 stars 99 forks source link

Interference with Filterable #576

Open GCIotron opened 8 months ago

GCIotron commented 8 months ago

Hello

I'm using latest version of the library for an android application written in java

I have Java VERSION_1_8 in compile option, Sdk 34 and using androidx.legacy:legacy-support-v4:1.0.0

I describe my issue with the library:

In my application I have an ArrayAdapter that implements Filterable.

Only after firing onMessageReceived of the Mqtt Client, i need to put some data in the arrayAdapter and filter it to show the results based on some criteria....

when the code calls the getFilter() method for the ArrayAdapter the code stops to execute when creating new Filter to return by the method and i got no logcat for this issue

public class MyArrayAdapter extends RecyclerView.Adapter implements Filterable {

[...] public Filter getFilter() {

    return new Filter() { <---- excactly here

[...]

This behavior is directly connected using the library from version 4.1 to version 4.2.3 and it not happend before the fire of onMessageReceived because the code calls the getFilter() method before also, and the getFilter() method works perfectly.

Using 4.0 version of the library I got no problems.

Thanks to all if you could find the reason of this issue.

hannesa2 commented 8 months ago

It's hard to understand what's exactly happen, without running code which demonstrate the issue. That's why I can only guess what's wrong here.

The first shot, is to get rid of VERSION_1_8 and using Java 17. Please give it a try.

GCIotron commented 8 months ago

It's hard to understand what's exactly happen, without running code which demonstrate the issue. That's why I can only guess what's wrong here.

The first shot, is to get rid of VERSION_1_8 and using Java 17. Please give it a try.

Hello, i've changed to Java 17, using library version 4.1 but the behavior didn't change. :( I will try to investigate making a small example to eventually share with you.