0

我正在制作一个安卓应用程序。

我有产品清单。

如果我当时选择一种产品,该产品Linkedin与用户名共享。

我想要下面的代码(twitter 分享的示例代码)。我想要同样的Linkedin

private final static Handler mTwitterHandler = new Handler();
    private static SharedPreferences prefs;

    public static boolean TWEET_LOGIN = false;

    final static Runnable mUpdateTwitterNotification = new Runnable() {
        public void run() {

        }
    };

    public static void sendTweet(Context con, final String msj) {

        prefs = PreferenceManager.getDefaultSharedPreferences(con);

        Thread t = new Thread() {
            public void run() {

                try {
                    TwitterUtils.sendTweet(prefs, msj);
                    mTwitterHandler.post(mUpdateTwitterNotification);
                } catch (Exception ex) {
                    ex.printStackTrace();
                    Log.d("dhaval-->send tweet:", ex.getMessage().toString());
                }
            }

        };
        t.start();
    }

如果是的话,是否有可能,那怎么办?

4

1 回答 1

0

我用过linkedin-j-android.jar 下载

将此代码放入AsyncTask后台执行

private void shareText_new() {

        // TODO Auto-generated method stub
        try {

            final LinkedInApiClientFactory factory = LinkedInApiClientFactory
                    .newInstance(generalClass.APIKEY, generalClass.APISECRET);
            final LinkedInApiClient client = factory.createLinkedInApiClient(
                    generalClass._Token1, generalClass._Secret1);

            client.postNetworkUpdate("hello DJ");
            System.out
                    .println("Your update has been posted. Check the LinkedIn site for confirmation.");

            System.out.println("Fetching your network updates of type:"
                    + NetworkUpdateType.STATUS_UPDATE);
            Network network = client.getNetworkUpdates(EnumSet
                    .of(NetworkUpdateType.STATUS_UPDATE));
            printResult(network);
        } catch (Exception e) {
            // TODO: handle exception
            Log.e("error share st--->", "" + e.getMessage().toString());
        }
    }

参考链接检查

全码

于 2013-02-26T10:01:26.743 回答