アプリケーションでのチャットに asmack を使用しています。次のコードの実行中にエラーが発生します。
mXmppConnection=connectionToXmppServer(HOST, PORT, SERVICE, mUserName, mPassword);
/*creating new chat room*/
MultiUserChat muc = new MultiUserChat(mXmppConnection, "DestinationCountry@conference.domainname");
try {
/*to create chat room*/
/*sending configration to server*/
muc.join(mUserName);
Form form = muc.getConfigurationForm();
Form answerForm = form.createAnswerForm();
answerForm.setAnswer("muc#roomconfig_persistentroom", true);
muc.sendConfigurationForm(answerForm);
/*muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));*/
/* muc.join("jack");*/
muc.sendMessage("i just joined the room");
Log.i("room name", muc.getRoom());
muc.addMessageListener(new PacketListener() {
@Override
public void processPacket(Packet packet) {
Message mess = (Message) packet;
Log.i("msg ",mess.getFrom() + ": " + mess.getBody());
}
});
} catch (XMPPException e) {
Toast.makeText(getApplicationContext(), "test room failed",
Toast.LENGTH_SHORT).show();
}
以下は私が得ているエラーです
02-15 17:54:28.409: E/AndroidRuntime(24400): at java.lang.Thread.run(Thread.java:856)
02-15 17:54:28.409: E/AndroidRuntime(24400): Caused by: java.lang.NullPointerException
02-15 17:54:28.409: E/AndroidRuntime(24400): at com.example.groupchat.GroupChat$ConnectTOChatServer.doInBackground(GroupChat.java:174)
02-15 17:54:28.409: E/AndroidRuntime(24400): at com.example.groupchat.GroupChat$ConnectTOChatServer.doInBackground(GroupChat.java:1)
02-15 17:54:28.409: E/AndroidRuntime(24400): at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-15 17:54:28.409: E/AndroidRuntime(24400): at java.util.concurrent.FutureTask.run(FutureTask.java:234)