2014-05-15 50 views
0

我试图用PINIT采用Android别起来SDK我的应用程序整合,但它给了我像的Android SDK Pinterest的:上传失败

错误

针未能updalod这里再试试

是我的代码

// pin it 
PinItButton.setDebugMode(true); 
PinItButton.setPartnerId(CLIENT_ID); 

PinItButton pinIt = (PinItButton) findViewById(R.id.pin_bt); 
pinIt.setImageResource(R.drawable.icon_pinterest); 
pinIt.setImageUrl("http://images.frandroid.com/wp-content/uploads/2012/11/Test-LG-Nexus-4-Gauche.png"); 
pinIt.setUrl("http://images.frandroid.com/wp-content/uploads/2012/11/Test-LG-Nexus-4-Gauche.png"); 
pinIt.setDescription(offerData.getOffer_description());  
pinIt.setListener(_listener); 

PinItListener _listener = new PinItListener() { 

    @Override 
    public void onStart() { 
     super.onStart(); 
     Log.i(APP_TAG, "PinItListener.onStart"); 
     statistics(); 
    } 

    @Override 
    public void onComplete(boolean completed) { 
     super.onComplete(completed); 
     if(completed) 
      Log.i(APP_TAG, "PinItListener.onComplete"); 
     else 
      Log.e(APP_TAG, "PinItListener.NotComplete"); 
    } 

    @Override 
    public void onException(Exception e) {   
     super.onException(e); 
     e.printStackTrace(); 
     Log.i(APP_TAG, "PinItListener.onException"); 
    } 

}; 

有没有人知道这段代码有什么问题?

+0

你能解决这个问题吗?面对同样的问题 –

回答

0
First declare this in onCreate() of activity: 

PinIt pinIt=new PinIt(); 

after that use this method in your pinit button click and pass imageUrl and description: 

public void pinImageOnPinterest(String imageUrl,String description){ 
     PinIt.setPartnerId(CLIENT_ID); 
     pinIt.setImageUrl(imageUrl); 
     pinIt.setDescription(description); 
     pinIt.setUrl("your set url"); 
     pinIt.setListener(new PinItListener() { 
       @Override 
      public void onStart() { 
       // TODO Auto-generated method stub 
       super.onStart(); 
      } 

       @Override 
      public void onComplete(boolean completed) { 
       // TODO Auto-generated method stub 
        super.onComplete(completed); 
        if(completed){ 
         Log.w("pinit", "Image posted on pinterest"); 
         //Toast.makeText(getActivity(), "Image Posted", Toast.LENGTH_SHORT).show(); 
        } 
      } 
       @Override 
      public void onException(Exception e) { 
       // TODO Auto-generated method stub 
        super.onException(e); 
        Toast.makeText(getActivity(), "Please install Pinterest App", Toast.LENGTH_SHORT).show(); 
        Log.w("pinit", "pinit exception :"+e); 

      } 
     }); 
     pinIt.doPinIt(getActivity()); 
    } 

希望这会帮助你。

+0

我尝试这段代码,但仍然给我同样的错误 – Mansi