可能的错误与三星的ROM? [英] Possible bug with Samsung roms?

查看:109
本文介绍了可能的错误与三星的ROM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在一个应用程序,显示联系人列表为用户的工作。

I'm currently working in an app that shows a contact list to the user.

在该列表中,名称,联络画面和联系人的电子邮件必须显示,所以得到的列表如下所示:

In that list, the name, the contact picture and the email of the contact must be shown, so I get the list like this:

final Cursor c = managedQuery(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,ContactsContract.CommonDataKinds.Email.TYPE + "="+ContactsContract.CommonDataKinds.Email.TYPE_HOME , null,ContactsContract.Contacts.DISPLAY_NAME);

int tamano= c.getCount();      

Log.e("USER", "The size of the contact list is : " + tamano);

和这里的东西...

我已经试过了3三星手机(2 GALAXY SII和1个ACE银河)和2宏达电(HTC 1 Desire S的1 HTC野火)。

I've tried it in 3 samsung mobiles (2 Galaxy SII and 1 Galaxy ACE), and 2 HTC (1 HTC Desire S and 1 HTC Wildfire).

的结果是,至少,滑稽:

The results are, at least, funny:

通过所有的星系:

联系人列表的大小是:9

The size of the contact list is : 9

随着HTC:

联系人列表的大小是482

The size of the contact list is 482

所有的手机都使用相同的Gmail帐户同步,所以有相同数量的联系人...

All the phones are sync with the same gmail account, so have the same number of contacts...

这怎么可能?有没有在三星ROM中的错误或什么?

How is this possible? Is there a bug or something in the Samsung roms?

您好!

的** *随着溶液编辑:

***EDIT WITH SOLUTION:

IT WORKS!现在我知道是什么问题:

IT WORKS! And now I know what the problem is:

ContactsContract.CommonDataKinds.Email.TYPE_HOME

问题是,三星不组织接触以同样的方式做的HTC,如今它的固定使用这个小小的变化:

The thing is that samsung doesn't organize the contacts the same way HTC does, and now it's fixed with this small change:

ContactsContract.CommonDataKinds.Email.TYPE_OTHER

现在所有的联系人出现在所有手机(除银河王牌,但可能是因为它具有奇特的ROM ...)谢谢!

Now all the contacts appear in all the phones (except in Galaxy Ace, but might be because of the strange rom it has...) THANKS!

推荐答案

我会改变您的查询像这样...

I would change your query like so...

= managedQuery(ContactsContract.Data.CONTENT_URI
, null
, ContactsContract.DATA.MIMETYPE+"=? AND "+ContactsContract.CommonDataKinds.Email.TYPE+"=?"
, new String[]{ContactsContract.CommonDataKinds.Email.Content_Item_Type, ContactsContract.CommonDataKinds.Email.TYPE_HOME}
, ContactsContract.DATA.DISPLAY_NAME );

我没有测试这一点,但应该是正确的或相似的。

I didn't test this but should be right or similar.

要显示光标,以帮助调试一个天真的方法

a naive method to display a Cursor to help with debugging

public static void displayCursor(Cursor c){
    int columnCount;
    if(c.moveToFirst()){
        columnCount = c.getColumnCount();
        do{
            Log.i(" ", "********************");
            for(int i=0;i<columnCount;i++){
                try{ 
                    Log.i(c.getColumnName(i)+":", c.getString(i)+" ");
                }catch(Exception e){

                }
            }
        }while(c.moveToNext());
    }
}

这篇关于可能的错误与三星的ROM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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