michael-rapp / AndroidPreferenceActivity

Provides an alternative implementation of Android's PreferenceActivity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Click's not registering on various Android versions.

ItsCalebJones opened this issue · comments

Unfortunately this is a really complex issue that I've spent the better half of a day troubleshooting. In the most simple explanation on various Android versions some preferences are not registering clicks.

On Android 6 and above, no SwitchPrefrerences or CheckboxPrefrerences are registering clicks.

On ~API 19 and below no CheckboxPrefrerences are registering clicks.

However, when I add my preference and fragment to your example project things are working perfectly.

I can attach an APK if you'd like to test it. You can view my code here and a quick demo of the issue.

Okay, this is super awkward. I've never encountered an issue like this. But if it does only happen in your app, but not in the library's example app, this is an indicator that there is a problem with your code, right?

I would try to create a minimal working example by step-by-step removing all code fragments, which are not absolutely necessary (e.g. listeners). As soon as the issue goes away, you know what's causing the problem.

I would agree if I hadn't already done that. =/ Which is why I tried using my fragment and preference xml in the example project. Even the style of the switches and the like are different. This is really bizarre. My next test is going to a clean project with no 3rd party libraries, that's the only thing left in my mind that can be affecting this.

Yes, maybe it is conflicting with a 3rd party library. I saw that you're using a lot of them.

I found the offender, my previous implementation of preferences relied on 'com.android.support:preference-v7'. Removing this fixed the issues I was having, might want to add that to the README.

I'm glad to hear that it works now. I've added this information to the README.

Just to update this:

This issue also arises if you include com.android.support:preference-v14 in your project next to this library. So if you want to use this library in production you first have to fully replace the default preference system.

@markusressel This library requires API level 14 at least (because of the AppCompat support library). So there is no need to use com.android.support:preference-v7 or com.android.support:preference-v14 anyway. Or do I miss something?

@michael-rapp I guess you're right. I just wanted to mention the v14 version here too for documentation purpose as I had the same problem but was not using v7.

@markusressel Thank you for pointing this out. I will add a notice to the readme.