Вы можете использовать эту ссылку
это
и, пожалуйста, этот метод ниже в этом
public String postPicture(String fileName) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
String provider = preferences.getString("pictureService","yfrog");
try {
File file = new File(fileName);
MediaProvider mProvider ;
if (provider.equals("yfrog"))
mProvider = MediaProvider.YFROG;
else if (provider.equals("twitpic"))
mProvider = MediaProvider.TWITPIC;
else
throw new IllegalArgumentException("Picture provider " + provider + " unknown");
String accessTokenToken = account.getAccessTokenKey();
String accessTokenSecret = account.getAccessTokenSecret();
Properties props = new Properties();
props.put(PropertyConfiguration.MEDIA_PROVIDER,mProvider);
props.put(PropertyConfiguration.OAUTH_ACCESS_TOKEN,accessTokenToken);
props.put(PropertyConfiguration.OAUTH_ACCESS_TOKEN_SECRET,accessTokenSecret);
props.put(PropertyConfiguration.OAUTH_CONSUMER_KEY,TwitterConsumerToken.consumerKey);
props.put(PropertyConfiguration.OAUTH_CONSUMER_SECRET,TwitterConsumerToken.consumerSecret);
Configuration conf = new PropertyConfiguration(props);
ImageUploaderFactory factory = new ImageUploaderFactory(conf);
ImageUpload upload = factory.getInstance(mProvider);
String url = upload.upload(file);
return url;
} catch (Exception e) {
e.printStackTrace(); // TODO: Customise this generated block
}
return null;
}