2

Twitter API *update_with_media* POST メソッドを呼び出して、Twitter4j を使用して写真をアップロードする方法はありますか? つまり、TwitPic や YFrog などの中間サービスを使用しないということですか?

それができない場合、Android ネイティブ アプリから画像付きのツイートを投稿する最良の方法は何ですか? Android アプリの実際の例について教えてもらえますか?

ありがとう!!

4

1 に答える 1

-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();
            }
于 2012-06-07T13:34:48.287 に答える