首页 \ 问答 \ Android:Facebook与内容分享链接(Android : Facebook share link with content)

Android:Facebook与内容分享链接(Android : Facebook share link with content)

我正在尝试与android中的内容分享链接。 我想在Android eclipse中使用它。

我在Android Studio中试过,它运行得很好。

编译'com.facebook.android:facebook-android-sdk:4.6.0'

if (ShareDialog.canShow(ShareLinkContent.class)) {
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
        .setContentTitle("How to share content")
        .setImageUrl(Uri.parse("https://www.numetriclabz.com/wp-content/uploads/2015/11/114.png"))
        .setContentDescription("simple LinkedIn integration")
        .setContentUrl(Uri.parse("https://www.numetriclabz.com/android-linkedin-integration-login-tutorial/"))
        .build();
    shareDialog.show(linkContent);  // Show facebook ShareDialog
}

此代码在Android Studio中完美运行。

当我在eclipse中尝试这个时它不起作用。 我为FacebookSDK库添加了库,但是“ ShareLinkContent ”没有在eclipse中导入

谁能帮帮我吗


I am trying to share a link with content in android. I want this in Android eclipse.

I tried in Android Studio, it was working perfectly.

compile 'com.facebook.android:facebook-android-sdk:4.6.0'

if (ShareDialog.canShow(ShareLinkContent.class)) {
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
        .setContentTitle("How to share content")
        .setImageUrl(Uri.parse("https://www.numetriclabz.com/wp-content/uploads/2015/11/114.png"))
        .setContentDescription("simple LinkedIn integration")
        .setContentUrl(Uri.parse("https://www.numetriclabz.com/android-linkedin-integration-login-tutorial/"))
        .build();
    shareDialog.show(linkContent);  // Show facebook ShareDialog
}

this code is working perfectly in Android Studio.

When I try this in eclipse it is not working. I add the library for FacebookSDK library , but the "ShareLinkContent" is not importing in eclipse

can any one please help me


原文:https://stackoverflow.com/questions/38449695
更新时间:2022-05-12 10:05

最满意答案

查看XMLHttpRequest: http//www.google.com/search? sourceid = chrome&ie = UTF-8&q = XHR
和Ajax: http//en.wikipedia.org/wiki/Ajax_ (programming)

基本上:创建XMLHttpRequest,
打开你的.php,
发送(null)和中提琴,你已经完成了。

XHR的作用是,它在后台请求页面并在后台加载它。 这就是你所需要的一切。

如果您需要页面的内容,您应该查看XHR.onreadystatechange和XHR.responseText


Look into XMLHttpRequest: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=XHR
and Ajax : http://en.wikipedia.org/wiki/Ajax_(programming)

Basically: create an XMLHttpRequest,
open your .php,
send(null) and viola, you're done.

What XHR does, is it requests the page in the background and loads it in the background. Thats pretty much all you need.

If you need the content of the page, you should look into XHR.onreadystatechange and XHR.responseText

相关问答

更多
  • 您需要使用AJAX来处理PHP代码并返回结果。 这是使用jQuery的AJAX处理程序的选项: # File: yourform.html
    当用户关闭页面时可靠地发送事件几乎是不可能的。 有onbeforeunload事件可以执行Ajax调用,但可能会失败,出于安全原因不会执行,或者根本不执行,因为用户关闭了JavaScript。 这通常是通过会话超时完成的:它会在最后一次请求某个会话时进行检查。 如果时间超过x分钟,会话将视为过期。 这不是一个选项吗? Reliably sending an event when the user closes the page is close to impossible. There is the onb ...
  • 查看XMLHttpRequest: http : //www.google.com/search? sourceid = chrome&ie = UTF-8&q = XHR 和Ajax: http : //en.wikipedia.org/wiki/Ajax_ (programming) 基本上:创建XMLHttpRequest, 打开你的.php, 发送(null)和中提琴,你已经完成了。 XHR的作用是,它在后台请求页面并在后台加载它。 这就是你所需要的一切。 如果您需要页面的内容,您应该查看XHR.o ...
  • 首先你应该设置一个服务器,然后才能执行你的php脚本。 如果你正在使用Windows,那么使用WAMP,否则如果你正在使用linux,请在终端上执行sudo apt-get install lamp-server ^ ..如果是windows,请将文件复制粘贴到C:\ wamp \ www (路径可能与通用格式不同 - Path \ to \ wamp \ www)。 如果是linux将它们复制/粘贴到/ var / www中 First you should set up a server , only ...
  • 您正在寻找的技术称为异步HTTP请求(Ajax),其最常见的实现是使用jQuery( http://api.jquery.com/jQuery.ajax/ )实现的。 基本上你的PHP功能在远程服务器上。 通常,这只能在页面重新加载时由客户端(访问者浏览器)访问。 一旦页面呈现,你的访问者在他们的浏览器中看到的html,以及呈现它的php代码在两个系统上,并且传统上只能在http请求期间进行通信(几乎按照定义重新加载页面)。 通过使用clientide javascript(Ajax),您可以从客户端访问您 ...
  • 您可以查看CURL库的C / C ++ 正常的控制台操作是微不足道的。 当您从用户处获得详细信息时,使用curl向服务器发起一个[登录]请求。 You can look into the CURL library for C/C++ The normal console actions are trivial. When you get the details from the user, use curl to initiate a [login] request to the server.
  • 假设您使用超链接进行投票,请查看HTML锚点以获得非常简单的解决方案。 您需要每个帖子的容器拥有它自己的唯一ID属性,然后在upvote / downvote href属性中引用该属性,创建一个浏览器将跳转到的锚点。 请参阅https://www.w3schools.com/html/html_links.asp例如 -
    Post content is here UPVOTE ...
  • 你可能关闭了short_open_tags ,所以
    ^^^^^^ 空间不被识别为开放标签。
    ^^^^^^ with the space isn't recognized as an open tag ...
  • 如果你正在使用LINUX 使用Cron Jobs # run the script at 4:30am every day 30 4 * * * lynx -dump http://www.yourwebsite.com/myscript.php 如果您的PHP脚本是CLI适合使用 30 4 * * * /usr/local/bin/php /home/me/myscript.php 如果你正在使用WINDOWS 使用sheduled任务http://windows.microsoft.com/en- ...
  • 检查它是否存在: // mainpage.php if ( ! isset($_SESSION['user_id'])) { die('pleases login again !'); } Check that it exists: // mainpage.php if ( ! isset($_SESSION['user_id'])) { die('pleases login again !'); }
  • 相关文章

    更多

    最新问答

    更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。