如何使用android在Facebook墙上分享视频?(How to share video on facebook wall using android?)
我试图使用最新的Facebook SDK文档在Facebook墙上分享视频,例如https://developers.facebook.com/docs/sharing/android#videos 。 我使用以下代码分享视频。
ShareVideo video = new ShareVideo.Builder().setLocalUrl( Uri.parse("/sdcard/DCIM/cut.mp4")).build(); ShareVideoContent content = new ShareVideoContent.Builder() .setVideo(video).build(); shareButton.setShareContent(content); shareButton.performClick();
但不可分享视频甚至不显示任何消息。
I have tried to share a video on facebook wall using latest facebook SDK doc i.e.https://developers.facebook.com/docs/sharing/android#videos. I have used following code for share video.
ShareVideo video = new ShareVideo.Builder().setLocalUrl( Uri.parse("/sdcard/DCIM/cut.mp4")).build(); ShareVideoContent content = new ShareVideoContent.Builder() .setVideo(video).build(); shareButton.setShareContent(content); shareButton.performClick();
but unabe to share video even not show any message.
原文:https://stackoverflow.com/questions/34064202
最满意答案
这返回了一个长度为1的R字符向量:
Curve.equation(lmab) [1] "-26488.6153547735+4928.74310702739*x-217.568666179266*x^2+4.00331698261622*x^3"
这将允许您获取该字符值并将其放入“空白”函数对象中。 不需要
eval
,因为parse
返回必要的表达式。 它执行测试是否可以从该字符值构建有效的R表达式树:func <- function(x){} body(func) <- parse(text=Curve.equation(lmab)) > func function (x) -26488.6153547735 + 4928.74310702739 * x - 217.568666179266 * x^2 + 4.00331698261622 * x^3
由于func现在是一个带有一个名为“x”的形式参数的函数,因此
curve
函数很高兴:png(); curve(func, -10,10); dev.off()
That returned an R character vector of length 1:
Curve.equation(lmab) [1] "-26488.6153547735+4928.74310702739*x-217.568666179266*x^2+4.00331698261622*x^3"
This will allow you to take that character value and place it into a "blank" function object. There is no need for
eval
, sinceparse
returns the necessary expression. It performs a test whether it's possible to build a valid R expression tree from that character value:func <- function(x){} body(func) <- parse(text=Curve.equation(lmab)) > func function (x) -26488.6153547735 + 4928.74310702739 * x - 217.568666179266 * x^2 + 4.00331698261622 * x^3
Since func is now a function with a single formal parameter named "x", the
curve
-function is happy:png(); curve(func, -10,10); dev.off()
相关问答
更多-
我并不是故意要求回答,但我想出了一个更多的答案 - 我发现我还没有尝试eval 。 eval(curve(substitute(g),from=0,to=3))不起作用,但是这样做: f1 <- function(g) { eval(substitute(curve(g,from=0,to=3))) } f1(x^2) 更新 :@RichardScriven建议do.call()也可以工作 - 它确实! f2 <- function(g) { do.call(curve,list(sub ...
-
您可以使用stat_function添加曲线: ggplot(data.frame(x=c(0, 10)), aes(x)) + stat_function(fun=sin) 也可以使用qplot ,但是还不清楚这是否更简单: qplot(c(0,2), fun=sin, stat="function", geom="line") 如果您的曲线函数更复杂,则使用lambda函数。 例如, ggplot(data.frame(x=c(0, 10)), aes(x)) + stat_function( ...
-
eval有一个参数envir ,它允许您指定要在其中评估表达式的环境。 所以, eval(parse(text=command[i]), envir=.GlobalEnv) 应该有希望工作。 eval has an argument, envir, that allows you to specify the environment in which you want to evaluate your expression. So, eval(parse(text=command[i]), envir=. ...
-
一种可能性是简单地包装在一个函数中, curve((function(x) eval(parse(text=formula)))(x), 0, 10) One possibility is to simply wrap in in a function, curve((function(x) eval(parse(text=formula)))(x), 0, 10)
-
如何使用R获得dnorm曲线(How to get dnorm curve using R)[2021-12-26]
你很亲密,这就是你所要求的(技术上): hist(x1000, col="red", freq=F) curve( dnorm(x, mean=.3,sd=sqrt(.3)), col="blue", add=T) # expression containing 'x' 但我认为你真正想要的是: curve( dnorm(x, mean=mean(x1000),sd=sd(x1000)), col="blue", add=T) 要么: curve( dnorm(x, mean=mean(x1000),s ... -
乘以函数曲线(Multiply a function curve)[2023-05-30]
如果你想按照你说的方式拥有它,你可以做这样的事情 %I'm making up a function x = 0:0.1:10; y = x.^2; [ft, ~] = fit( x, y, 'poly2' ); %Put in the new formula, the formula() function puts out the formula as a string and then just pre- and append a "x*" fitType = fittype(['x*(',formu ... -
你可以使用curveVertex()函数。 这并不完全符合你的要求,但你可以一直玩下去,直到它做到: //body fill(255, 0, 0); beginShape(); curveVertex(-200, -350); curveVertex(50, -150); curveVertex(250, 250); curveVertex(-150, 50); curveVertex(-200, -200); endShape(); 请注意,您可以使用多个块来填充不同 ...
-
使用 curve(pow(2)(x),-2,2) 在curve()的文档中,它期望 函数的名称,或作为x函数编写的调用或表达式,它将计算为与x相同长度的对象。 所以f是函数的名称,这就是为什么它起作用。 你也可以调用curve(f(x),-2,2) 。 但是pow(2)不是函数的名称,它是一个返回函数的函数调用。 但是当curve看到一个函数调用时,它希望看到该函数被写为x的函数。 因此,通过添加(x)部分,我们将其转换为curve()理解的函数调用。 Use curve(pow(2)(x),-2,2) ...
-
只要您尝试执行修改公式内容的操作,就应该使用update因为它是为此目的而设计的。 在您的情况下,您想要修改您的功能,如下所示: residuals.DF = function(data, resid.var, suffix="") { lm_f = function(x) { x = residuals(lm(data=data, formula= update(x ~ 0, paste0("~",resid.var)))) } resid = data.frame(apply(dat ...
-
试图在曲线()中使用eval(解析(text = function()))(Trying to eval(parse(text=function())) to be used in curve())[2023-02-22]
这返回了一个长度为1的R字符向量: Curve.equation(lmab) [1] "-26488.6153547735+4928.74310702739*x-217.568666179266*x^2+4.00331698261622*x^3" 这将允许您获取该字符值并将其放入“空白”函数对象中。 不需要eval ,因为parse返回必要的表达式。 它执行测试是否可以从该字符值构建有效的R表达式树: func <- function(x){} body(func) <- parse(text=C ...