Ho un'app per Android tramite la quale posso aggiornare con successo lo stato di Twitter. Lo sto usando per condividere collegamenti a una pagina web che mostra un'immagine. Penso che sarà bello avere un'anteprima ridotta dell'immagine insieme al tweet allo stesso modo di instagram. Come posso caricare questa immagine insieme al mio tweet?Android twitter4j upload image
10
A
risposta
43
Ho avuto lo stesso requisito a volte indietro e finalmente venire con la funzione potrebbe essere che ti aiuterà anche.
/**
* To upload a picture with some piece of text.
*
*
* @param file The file which we want to share with our tweet
* @param message Message to display with picture
* @param twitter Instance of authorized Twitter class
* @throws Exception exception if any
*/
public void uploadPic(File file, String message,Twitter twitter) throws Exception {
try{
StatusUpdate status = new StatusUpdate(message);
status.setMedia(file);
twitter.updateStatus(status);}
catch(TwitterException e){
Log.d("TAG", "Pic Upload error" + e.getErrorMessage());
throw e;
}
}
Nota: Per utilizzare questo si prega di assicurarsi di avere ultimo file jar ho usato per questo twitter4j-core-2.2.5.jar
Problemi correlati
- 1. Android-Django Image upload
- 2. Jersey Image Upload Client
- 3. dropzone.js image upload acceptedMimeTypes
- 4. Retweet usando Twitter4j Android
- 5. Image upload CURL in PHP Curl
- 6. Utilizzo della libreria Twitter4j per Android
- 7. Android Twitter xAuth esempio con twitter4j
- 8. Android: Login con Twitter utilizzando Twitter4J
- 9. Editor on-image-upload angolare-Summernote Object Undefined
- 10. Android Image Editor
- 11. Android WallpaperManager crops image
- 12. Animazione sfocatura Android Image
- 13. Filtro flusso twitter4j
- 14. PHP upload S3 upload
- 15. android image inside single select
- 16. ottenere Image ThumbNail in Android
- 17. android gallery image position problem
- 18. Rimozione Image Button Imbottitura (Android)
- 19. FTP Upload e download su Android
- 20. Upload and Download rate profiling in Android
- 21. twitter4j => AndroidRuntime (446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken
- 22. Twitter4j: ricerca di tweet pubblici
- 23. Tessuto Twitter o Twitter4j non ufficiale?
- 24. Fill pattern in Image in Android
- 25. Principiante di Android - Place Image at DragEvent
- 26. Paperclip: upload dall'URL con l'estensione
- 27. AFNetworking multiplo upload di file
- 28. Django ModelForm Imagefield Upload
- 29. Carrierwave multi file (foto) upload
- 30. Angular JS Image Crop Directive
provare questo per vaso twitter4j aggiornato http://stackoverflow.com/questions/17093499/how -to-post-immagine-per-twitter-in-android/20633178 # 20633178 – Prachi