Uploading pictures to Twitter from android with Twitter4j

Is there any way to call the Twitter API *update_with_media* POST method to upload photos by using Twitter4j? I mean, without using a middle service as TwitPic or YFrog?

If it is not possible, what is the best way to post tweets with pictures from an android native app? Could anybody tell me about a working example for android apps?



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");


Need Your Help

Searching in mega size multidimentional array using php mysql

php mysql arrays preg-match

I have a table of millions records with some multidimensional array. I need to search in each row to find a match, the key matches are in another table with thousands of records.

How do a select option selection pick from some other page using HTML and JavaScript only?

javascript html html-select

I have two pages, one where the user chooses an option (A) the other where that option is used (B). When the users have made their choice, they should be redirected to page B.