[rabbitmq-discuss] Android: unable to open stack traces error
Kamran
muhammad.kamrana at gmail.com
Mon Feb 20 16:56:28 GMT 2012
The following code gives "unable to open stack traces error" I am try
to send data from Java Client on Android to Java File (https://
github.com/rabbitmq/rabbitmq-tutorials/blob/master/java/Recv.java)
I have also included the permissions of "write_external_storage" and
"internet". If I disable the "handler.post(send)" then it doesn't
gives the error but the job is not done.
Android Code:
TextView mOutput;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mOutput = (TextView) findViewById(R.id.output);
Handler handler = new Handler();
Runnable send = new Runnable(){
public void run() {
// TODO Auto-generated method stub
send();
}
};
mOutput.append("/nBefore");
handler.post(send);
mOutput.append("/nAfter");
}
private void send(){
Thread thread = new Thread(){
@Override
public void run(){
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("sethost");
Connection connection = null;
try {
connection = factory.newConnection();
mOutput.append("/ninstance1");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Channel channel = null;
try {
mOutput.append("/ninstance2");
channel = connection.createChannel();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mOutput.append("/ninstance3");
channel.queueDeclare("hello", false, false, false,
null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String message = "Kamran Android E";
try {
mOutput.append("/ninstance4");
channel.basicPublish("logs","hello", null,
message.getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
thread.start();
}
}
More information about the rabbitmq-discuss
mailing list