小编Gho*_*deh的帖子

Android-按ID从arraylist中删除项目

我的适配器(RecyclerView)中有一个arraylist。

我必须按ID从数组列表中删除一个项目:

public static ArrayList<News> newsList = new ArrayList<News>();
Run Code Online (Sandbox Code Playgroud)

我填写了如下的数组列表:

News n = new News();
n.id = data.getString("from_user_id");
n.comments = data.getString("message");
n.title = data.getString("name");
n.time = time;
newsList.add(n);
Run Code Online (Sandbox Code Playgroud)

我想通过其id(n.id)值从此列表中删除一个项目。

我怎样才能做到这一点 ?

android arraylist

2
推荐指数
1
解决办法
3083
查看次数

标签 统计

android ×1

arraylist ×1