想在不指定数据类型的情况下将所有类型的数据添加到适配器中。对于数据类型,我将在服务器上针对文件类型将此值硬编码为1,2,3,4。
字符串类型= ContactObject.get(“ type”)。isJsonNull()吗? “”:ContactObject.get(“ type”)。getAsString();
for(int InnerCount = 0; InnerCount SessionDto movie1 = new SessionDto(SessionDto.IMAGE_TYPE,sendername,shortTimeStr,url);
movieList.add(movie1);
RecentAdapter.notifyDataSetChanged();
if (type.equals("3")){
//Toast.makeText(MainActivity.this, url, Toast.LENGTH_SHORT).show();
SessionDto movie = new SessionDto(SessionDto.AUDIO_TYPE,sendername,shortTimeStr,url);
audioList.add(movie);
RecentAdapter.notifyDataSetChanged();
}
else if (type.equals("1")){
SessionDto movie = new SessionDto(SessionDto.IMAGE_TYPE,sendername,shortTimeStr,url);
imageList.add(movie);
RecentAdapter.notifyDataSetChanged();
}
else if (type.equals("2")){
SessionDto movie = new SessionDto(SessionDto.Video_TYPE,sendername,shortTimeStr,url);
videoList.add(movie);
RecentAdapter.notifyDataSetChanged();
}
else if (type.equals("4")){
SessionDto movie = new SessionDto(SessionDto.Doc_TYPE,sendername,shortTimeStr,filename);
docList.add(movie);
RecentAdapter.notifyDataSetChanged();
}
}
}