2012-06-07 2 views
2

Twitter API * update_with_media * POST 메서드를 사용하여 Twitter4j를 사용하여 사진을 업로드 할 수 있습니까? 중간 서비스를 TwitPic 또는 YFrog로 사용하지 않고 말이지요?Twitter4j로 안드로이드에서 트위터에 사진 업로드

안드로이드 기본 응용 프로그램의 사진으로 트윗을 올리는 가장 좋은 방법은 무엇입니까? 아무도 안드로이드 애플 리케이션을위한 작동 예제에 대해 말해 줄 수 있습니까?

감사합니다.

+0

아직 답을 얻었습니까? –

답변

-1
if (requestCode == CAMERA_REQUEST) { 
      mImageUri = data.getData(); 
      mPath = getRealPathFromURI(mImageUri); //from Gallery 

      if (mPath == null) 
       mPath = mImageUri.getPath(); //from File Manager 

      if (mPath != null) 
       bitmap = BitmapFactory.decodeFile(mPath); 
     } else { 
      mPath = mImageUri.getPath(); 
      bitmap = BitmapFactory.decodeFile(mPath); 
     } 
Authorization auth=twitter.getAuthorization(); 
      ImageUpload uploadPhoto=ImageUpload.getTwitpicUploader(TwitPic_api_Key, (OAuthAuthorization) auth); 
      Log.d(TAG, "Start sending image..."); 

      try { 
       url = uploadPhoto.upload(new File(mPath)); 
       result = 1; 
       Log.d(TAG, "Image uploaded, Twitpic url is " + url);    
      } catch (Exception e) {   
       Log.e(TAG, "Failed to send image"); 

       e.printStackTrace(); 
      }