Java 为什么列表视图中的搜索筛选器不工作
我已经创建了一个列表视图,并在其中添加了一个编辑文本,这样我就可以搜索列表,但它不会返回任何内容。我有一个适配器,它可以显示所有数据,如频道数、图像和标题 适配器:Java 为什么列表视图中的搜索筛选器不工作,java,android,android-studio,listview,Java,Android,Android Studio,Listview,我已经创建了一个列表视图,并在其中添加了一个编辑文本,这样我就可以搜索列表,但它不会返回任何内容。我有一个适配器,它可以显示所有数据,如频道数、图像和标题 适配器: adapterEPG = new ArrayAdapter(this,R.layout.playlistitemwithimg, arrClPlaylist) { @Override public View getView(int position, View convertView,
adapterEPG = new ArrayAdapter(this,R.layout.playlistitemwithimg, arrClPlaylist) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (arrClPlaylist.get(position).nbtries < 1) {
convertView = getLayoutInflater().inflate(R.layout.playlistitemwithimg, null);
} else {
convertView = getLayoutInflater().inflate(R.layout.playlistitem_warning, null);
}
TextView num = (TextView) convertView.findViewById(R.id.number);
TextView name = (TextView) convertView.findViewById(R.id.playlistitem);
ImageView img = (ImageView) convertView.findViewById(R.id.imageViewChannel);
MainActivity.imageloader.displayImage(String.valueOf(arrClPlaylist.get(position).logo),img, MainActivity.options);
name.setText(arrClPlaylist.get(position).service_name);
num.setText(String.valueOf(position+1));
if (firstTimeStartup && position == channelIndex) {
//This is the first time we open the menu, and the iterator reached the previously chosen channel
initialChosenPosition = position;
//Highlight the background
name.setBackgroundColor(ContextCompat.getColor(PlayerWatchNowActivityVLC.this, R.color.primary_dark));
} else if (!firstTimeStartup && position == initialChosenPosition) { //This is not the first time the menu opens, and the iterator reached the initially chosen channel
//Return background to original state
name.setBackgroundColor(ContextCompat.getColor(PlayerWatchNowActivityVLC.this, R.color.primary_dark));
}
//Force a refresh after fixing the appropriate background
return convertView;
}
};
controls_container.setAdapter(adapterEPG);
我遵循了本教程:
我认为正在发生的事情是,搜索没有被用于标题
mObjects = {ArrayList@5817} size = 21
0 = {ClPlaylist@5944}
is_multicast = "0"
is_watermark = "0"
logo = "http://exemple.com/media/services_thumbs/NatGeo.png"
logo_big = "http://exemple.com/media/services_thumbs/NatGeo.png"
nbtries = 0
service_id = "5acf5bfb4e44941"
service_name = "National Geographic"
url = "http://dst.exemple.com/5acf5bfb4e44941/_definst_/smil:myStream_stb.smil/playlist.m3u8?t=5f45137c4f845"
shadow$_klass_ = {Class@4721} "class com.exemple.objects.ClPlaylist"
shadow$_monitor_ = -2072218533
1 = {ClPlaylist@5945}
2 = {ClPlaylist@5946}
3 = {ClPlaylist@5947}
4 = {ClPlaylist@5948} ...
适配器内部是(调试器内部):
服务名称就是标题
mObjects = {ArrayList@5817} size = 21
0 = {ClPlaylist@5944}
is_multicast = "0"
is_watermark = "0"
logo = "http://exemple.com/media/services_thumbs/NatGeo.png"
logo_big = "http://exemple.com/media/services_thumbs/NatGeo.png"
nbtries = 0
service_id = "5acf5bfb4e44941"
service_name = "National Geographic"
url = "http://dst.exemple.com/5acf5bfb4e44941/_definst_/smil:myStream_stb.smil/playlist.m3u8?t=5f45137c4f845"
shadow$_klass_ = {Class@4721} "class com.exemple.objects.ClPlaylist"
shadow$_monitor_ = -2072218533
1 = {ClPlaylist@5945}
2 = {ClPlaylist@5946}
3 = {ClPlaylist@5947}
4 = {ClPlaylist@5948} ...
任何帮助都将不胜感激!
谢谢大家!