public class TestRubrica {
/**
* Returns IM map informations
* ID_Contact - The ID to search
*/
public Map ImMapById(int Id_Contact) {
Map M1 = new Map();
M1.Initialize();
List L1 = new List();
L1.Initialize();
ContentResolver cr = BA.applicationContext.getContentResolver();
String imWhere = ContactsContract.Data.CONTACT_ID + " = ? AND "
+ ContactsContract.Data.MIMETYPE + " = ?";
String[] imWhereParams = new String[] { String.valueOf(Id_Contact),
ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE };
Cursor imCur = cr.query(ContactsContract.Data.CONTENT_URI, null,
imWhere, imWhereParams, null);
/** if (imCur.moveToFirst()) { */
if (imCur.getCount() > 0) {
while (imCur.moveToNext()) {
String imName = imCur
.getString(imCur
.getColumnIndex(ContactsContract.CommonDataKinds.Im.DATA));
String imType;
imType = imCur
.getString(imCur
.getColumnIndex(ContactsContract.CommonDataKinds.Im.TYPE));
String imProtocol;
imProtocol = imCur
.getString(imCur
.getColumnIndex(ContactsContract.CommonDataKinds.Im.PROTOCOL));
L1.Add(imType);
L1.Add(imName);
L1.Add(imProtocol);
AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), L1);
M1.Put(Id_Contact,L1);
}
}
imCur.close();
AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), M1);
return M1;
}