私はアンドロイドが初めてです。チャットリストにいる友達に画像を送信する機能を持つFacebookチャットアプリケーションを開発しています。asmack api FileTranfer クラスを使用して画像を送信しようとしました。しかし、送信に問題がありました。asmack api を使用してファイルを転送するコードを次に示します。
// Create the file transfer manager
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222, "chat.facebook.com");
config.setDebuggerEnabled(true);
config.setSASLAuthenticationEnabled(true);
FileTransferManager manager = new FileTransferManager(new XMPPConnection(config));
// Create the outgoing file transfer
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(friend_id);
// Send the file
transfer.sendFile(new File("path of image from sd card"), "You won't believe this!");
Here, throwing a NullPointerException at the FileTransferManager statement
Android用Facebook公式APIで画像、音声、動画を送信する方法はありますか。私に助言してください。前もって感謝します。