Android 使用安卓内容提供商通过Instagram共享时图像损坏

Android 使用安卓内容提供商通过Instagram共享时图像损坏,android,android-contentprovider,instagram,Android,Android Contentprovider,Instagram,我已经使用内容提供者发送Uri中的文件。我使用了以下代码来执行此操作: public Uri fileSharingUsingContentProvider(File tempFile) { String filePath = tempFile.getAbsolutePath(); // tempFile is the image file .... Cursor mCursor = this.getApplicationContext().getContentResolver().quer

我已经使用内容提供者发送Uri中的文件。我使用了以下代码来执行此操作:

public Uri fileSharingUsingContentProvider(File tempFile)
{
 String filePath = tempFile.getAbsolutePath(); // tempFile is the image file ....
 Cursor mCursor = this.getApplicationContext().getContentResolver().query(
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            new String[] { MediaStore.Images.Media._ID },
            MediaStore.Images.Media.DATA + "=? ",
            new String[] { filePath }, null);


  if(mCursor != null && mCursor.moveToFirst()){

        int id = mCursor.getInt(mCursor.getColumnIndex(MediaStore.MediaColumns._ID));
        Uri baseUri = Uri.parse("content://media/external/images/media");


        Trace.d(TAG,"<==> The baseUri after parsing : " + Uri.withAppendedPath(baseUri, ""+id));
        return Uri.withAppendedPath(baseUri, "" + id);
  }
  else {
        if (tempFile.exists()) {
            ContentValues values = new ContentValues();
            values.put(MediaStore.Images.Media.DATA, filePath);

            return this.getApplicationContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
        } 
        else {
            return null;
        }
   }
}
公共Uri文件共享内容提供程序(文件tempFile)
{
字符串filePath=tempFile.getAbsolutePath();//tempFile是图像文件。。。。
Cursor mCursor=this.getApplicationContext().getContentResolver().query(
MediaStore.Images.Media.EXTERNAL\u CONTENT\u URI,
新字符串[]{MediaStore.Images.Media.\u ID},
MediaStore.Images.Media.DATA+“=?”,
新字符串[]{filePath},null);
if(mCursor!=null&&mCursor.moveToFirst()){
intid=mCursor.getInt(mCursor.getColumnIndex(MediaStore.MediaColumns._id));
Uri baseUri=Uri.parse(“content://media/external/images/media");
Trace.d(标记“解析后的baseUri:”+Uri.withAppendedPath(baseUri,“+id));
返回Uri.withAppendedPath(baseUri,“+id);
}
否则{
if(tempFile.exists()){
ContentValues=新的ContentValues();
value.put(MediaStore.Images.Media.DATA,filePath);
返回此.getApplicationContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL\u CONTENT\u URI,值);
} 
否则{
返回null;
}
}
}
但问题是,当我尝试通过Instagram分享时,这段代码对所有设备都非常有效,除了Galaxy Note 2(图像文件已损坏)之外。我试过几种方法,但都没能解决这个问题。如果有人对这件事有任何想法,请帮助我


提前谢谢

经过长时间的研究,我终于找到了解决这个问题的方法。在我目前正在开发的应用程序的一部分中,我必须下载智能手机内部存储器中的图像。但是,如果图片分辨率很高,如(6480 x 4320)像素,则Galaxy Note 2无法在Instagram中上载图像。但对于低分辨率图像,它工作得非常好。我想在下载图像时,我必须修正图像分辨率。因此,如果有人面临这类问题,首先必须关注图像大小

另一个重要问题是,此图像大小问题仅出现在Galaxy Note 2中。
对于其他设备,在Instagram中上载图像时没有问题