Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.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 如何使用graph api将图像发布到facebook墙_Android - Fatal编程技术网

Android 如何使用graph api将图像发布到facebook墙

Android 如何使用graph api将图像发布到facebook墙,android,Android,我的活动中有一个位图,我试图将其转换为如下所示的字符串 位图位图=getIntent().getParcelableExtra(“数据”) //方法将位图转换为字符串 public String BitMapToString(Bitmap bitmap){ ByteArrayOutputStream baos=new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG,100, baos)

我的活动中有一个位图,我试图将其转换为如下所示的字符串

位图位图=getIntent().getParcelableExtra(“数据”)

//方法将位图转换为字符串

  public String BitMapToString(Bitmap bitmap){
     ByteArrayOutputStream baos=new  ByteArrayOutputStream();
     bitmap.compress(Bitmap.CompressFormat.PNG,100, baos);
     byte [] b=baos.toByteArray();
     String temp=Base64.encodeToString(b, Base64.DEFAULT);
     return temp;
}

我将这个字符串发送到Facebook Graph api,如下所示

String res=  

UrltoValue.getValuefromUrl("https://graph.facebook.com/"+Login.facebookid+"/feed?access_token="+accesstoken+"&method="+"post"+"&message="+"hi"+"&picture="+strpostimageurl);
但是我得到了非法的角色回应

12-06 14:47:16.488: E/post response(21627): Illegal character in query at index 281: https://graph.facebook.com/100001574672236/feed?access_token=AAAGaMRblwW4BAOdRuZCHNSxtpAPd8O05fXBDY0yF10sWf7tv1wlW7xX6WituirF6g7bZAMCflHPb5qLzeNYOmItEZBzeewNZBNF09KrpZBgZDZD&method=post&message=hi&picture=iVBORw0KGgoAAAANSUhEUgAAALcAAAChCAYAAACF4S4ZAAAABHNCSVQICAgIfAhkiAAAIABJREFU

如何将位图发送到Facebook api以显示图像

我想使用Graph api,因为我必须在多个朋友的墙上发布。您只能通过Graph api与图像url共享图像。Graph api不支持Base64字符串图像。我可以将位图转换为图像url吗?您可以将该位图上载到某个服务器并从服务器获取图像url。您可以使用类似Amazon s3的服务上载图像并获取图像的实时url。
12-06 14:47:16.488: E/post response(21627): Illegal character in query at index 281: https://graph.facebook.com/100001574672236/feed?access_token=AAAGaMRblwW4BAOdRuZCHNSxtpAPd8O05fXBDY0yF10sWf7tv1wlW7xX6WituirF6g7bZAMCflHPb5qLzeNYOmItEZBzeewNZBNF09KrpZBgZDZD&method=post&message=hi&picture=iVBORw0KGgoAAAANSUhEUgAAALcAAAChCAYAAACF4S4ZAAAABHNCSVQICAgIfAhkiAAAIABJREFU