[英]i Want to get incoming number from call log , but Without repeating the number If the process is repeated for the same number
this my code but it return repeating number 这是我的代码,但返回重复号
Cursor c = getApplicationContext().getContentResolver()
.query(CallLog.Calls.CONTENT_URI, null, CallLog.Calls.TYPE+" = ? ",
new String[]{String.valueOf(CallLog.Calls.INCOMING_TYPE)},
CallLog.Calls.DATE + " DESC");
ListView numListView = (ListView) findViewById(R.id.list);
CallCursorAdapter adapter = new CallCursorAdapter(this, c);
numListView.setAdapter(adapter);
You can use Hashset
to remove duplicate value from your list. 您可以使用Hashset
从列表中删除重复的值。 Here is the example for hashSet. 这是hashSet的示例。
Does adding a duplicate value to a HashSet/HashMap replace the previous value 是否将重复的值添加到HashSet / HashMap会替换先前的值
in the question you can see how they are adding value in the Hashset. 在问题中,您可以看到它们如何在哈希集中增加价值。 After adding value in the Hashset then pass this list your adapter. 在Hashset中添加值之后,然后将此列表传递给您的适配器。
That's it... 而已...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.