2013-02-26 33 views
0

我正在做一个Android应用程序。ANDROID - 更新状态链接(在应用程序的背景)

我有产品清单。

如果我当时选择一个产品与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(); 
    } 

如果是的话可以或不可以如何?

回答

0

我用linkedin-j-android.jardownload

把这个代码中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()); 
     } 
    } 

参考链接checkit

fullCode