有没有办法同时过滤具有多种类型过滤器的适配器?

时间:2015-09-09 14:54:53

标签: java android listview filter android-arrayadapter

我尝试使用三种不同类型的过滤器来过滤由适配器创建的列表,但无论我做什么,我都无法在过滤器同时选择它们时使过滤器尊重这三种过滤器。用户。如果用户只激活一种过滤器,它可以正常工作。

我认为这是因为在getFilter方法中,它过滤了三次,但是当第二种类型的过滤器开始时,它没有考虑第一种过滤器的作用。

如何过滤我的列表,使其尊重所有三个过滤器?

我尝试寻找方法,但这些是我能找到的最接近我的问题的方法:

How to apply multiple Filters on an Adapter?

Filtering ListView with custom (object) adapter

但它们都没有处理同时应用的多个过滤器。

这是我的适配器代码:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
    exec(code, m.__dict__)
  File "app.py", line 14, in <module>
  File "/Library/Python/2.7/site-packages/scapy-2.3.1-py2.7.egg/scapy/all.py", line 16, in <module>
    from arch import *
  File "/Library/Python/2.7/site-packages/scapy-2.3.1-py2.7.egg/scapy/arch/__init__.py", line 75, in <module>
    from bsd import *
  File "/Library/Python/2.7/site-packages/scapy-2.3.1-py2.7.egg/scapy/arch/bsd.py", line 12, in <module>
    from unix import *
  File "/Library/Python/2.7/site-packages/scapy-2.3.1-py2.7.egg/scapy/arch/unix.py", line 20, in <module>
    from pcapdnet import *
  File "/Library/Python/2.7/site-packages/scapy-2.3.1-py2.7.egg/scapy/arch/pcapdnet.py", line 27, in <module>
    import pcap
  File "build/bdist.macosx-10.10-x86_64/egg/pcap.py", line 7, in <module>
  File "build/bdist.macosx-10.10-x86_64/egg/pcap.py", line 4, in __bootstrap__
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1161, in resource_filename
    self, resource_name
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1854, in get_resource_filename
    "resource_filename() only supported for .egg, not .zip"
NotImplementedError: resource_filename() only supported for .egg, not .zip

在这种情况下,由于getFilter只接受一个约束,我需要能够检查多个,我创建了一个过滤器数组,如果它们不为空则检查每个过滤器并应用该操作。

filterArray [9]是第二种过滤器的位置。

filterArray 0到8包含可以选择进行过滤的公司

以下是用户按下“应用过滤器”按钮时调用的方法:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['app.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

0 个答案:

没有答案