Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在api级别8中制作vcard时不要插入图像源代码_Android_Vcf Vcard - Fatal编程技术网

Android 在api级别8中制作vcard时不要插入图像源代码

Android 在api级别8中制作vcard时不要插入图像源代码,android,vcf-vcard,Android,Vcf Vcard,我正在使用此代码制作Vcard,现在我想在我的Vcard中不要插入图像代码,所有其他的东西都将添加到Vcard中,我是如何做到的。。。。我在用这个 String VCard = ""; Cursor phones = getContentResolver().query(android.provider.ContactsContract.Contacts.CONTENT_URI , null,null, null, null); phone

我正在使用此代码制作Vcard,现在我想在我的Vcard中不要插入图像代码,所有其他的东西都将添加到Vcard中,我是如何做到的。。。。我在用这个

         String VCard = "";

         Cursor phones = getContentResolver().query(android.provider.ContactsContract.Contacts.CONTENT_URI , null,null, null, null);
         phones.moveToFirst();
         pDialog.setMax(phones.getCount());
           for(int i =0;i<phones.getCount();i++)
           {

              String lookupKey =  phones.getString(phones.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
              Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);

              AssetFileDescriptor fd;
             try 
             {
                 fd = getContentResolver().openAssetFileDescriptor(uri, "r");
                 FileInputStream fis = fd.createInputStream();
                 byte[] buf = new byte[(int) fd.getDeclaredLength()];
                 fis.read(buf);
                 VCard += new String(buf);
                 String y =String.valueOf(i);
                 publishProgress(y);
                 phones.moveToNext();                           
                 Log.d("Vcard",  VCard);
             } 
             catch (Exception e1) 
             {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
             }

         }

        try {
            FileOutputStream mFileOutputStream = new FileOutputStream(file, false);
              mFileOutputStream.write(VCard.toString().getBytes());
              mFileOutputStream.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
String VCard=“”;
Cursor phones=getContentResolver().query(android.provider.ContactsContract.Contacts.CONTENT\u URI,null,null,null);
moveToFirst();
pDialog.setMax(phones.getCount());
对于(int i=0;i
我再次修改它,用于for循环


我再次修改了它,在for loop中使用

它不再工作,它正在vcardsir中获取图像代码进入聊天室它不再工作,它正在vcardsir中获取图像代码进入聊天室
    String lookupKey = phones.getString(phones
    .getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri vcardUri = ContactsContract.Contacts.CONTENT_VCARD_URI
    .buildUpon()
    .appendQueryParameter("nophoto", String.valueOf(true))
    .build();
Uri uri = Uri.withAppendedPath(vcardUri, lookupKey);