获得频繁的短信 [英] Getting Frequent Outgoing SMS

查看:76
本文介绍了获得频繁的短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android应用程序中,我想访问在特定时间段内最常发送邮件的联系人。通过使用服务和广播接收器,我访问了outms短信详细信息:联系人,时间,没有发送的消息(取决于消息的长度)。现在我想要计算每个联系人出现在游标中然后加上它(消息号)然后对结果进行排序,给出最常见的外发消息和联系人。

问题是如何获取光标中特定记录(每个联系人)的计数?

In an android application, I want to access the contacts to whom messages are sent most frequently in a particular period. By using servives and broadcast receiver, I have accessed outoging sms details: contact, time, no of messages sent(depending on length of message). Now I want to to get count of each contact appearing in a cursor then adding up its (no. of messages) and then sort the results giving most frequent outgoing messages and contacts.
The question is how to get count of a particular record (each contact) in cursor ?

推荐答案

根据您的信息,您可以获得否。每个联系人发送的消息对吗?

在这里你可以这样做,



1.创建一个包含一个类的频道(FrequentContact)另一个班级列表(ContactCount)



2. ContactCount类包含ContactName,ContactNumber,Count属性。



3.遍历您的联系人并检查每个联系人是否有正在发送的短信联系号码,如果相等,则检查此联系人是否已存在于FrequentContact类列表中。



4.如果FrequentContact列表中没有联系人,请添加此联系人并增加计数。(这应该只是第一次)



5。如果联系人确实存在,那么通过FrequentContact对象获取联系的索引并找到匹配的联系人,然后递增Count属性。



6.最后你将获取联系人列表及其计数,然后您可以根据计数和显示进行排序android中的列表视图或其他控件,也可以实现排序功能。

From your information, you are able to get the no. of messages each contact sent right?
Here you can do in this way,

1.Create a class (FrequentContact) which contains a list of another class (ContactCount)

2. ContactCount class contains ContactName,ContactNumber,Count properties.

3. loop through your contacts and check for each contact with out going sms contact number and if its equal then check if this contact is already exists in the list of FrequentContact class.

4. If the contact does not exists in FrequentContact list add this Contact and increment the count.(this should be done for only first time)

5. If the contact does exists then get the index of the contact with loop through the FrequentContact object and find the matching contact and then increment the Count property.

6. Finally you will get the list of Contacts and their Count and then you can sort based on Count and show in a list view or some other control in android and can also implement the sorting feature.
Class FrequentContact
{

public List<contact> ContactCount {get;set;};

}

Class ContactCount
{

public string ContactName {get;set;};
public stirng ContactNumber {get;set;};
public long Count {get;set;};

public int GetCount()
{}

//and do write the necessary methods that are required for you.

}</contact>





希望这会在某种程度上引导您,请随时发布你在这里有疑问或疑问。





谢谢

Ganesh



Hope this guides you to some extent and please feel free to post your doubts or queries here.


Thanks
Ganesh


这篇关于获得频繁的短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆