how to implement alljoyn in several activities of android?

asked 2014-06-22 20:56:43 -0700

gumuruh gravatar image

Sorry the question is quite general but the case is like this...

I have 2 activities (2 layouts) that each of them have similar usage. FirstActivity (showing the devices discovered). SecondActivity (showing the chatting between device A and device B).

My question is, is it proper if 1) I use one system alljoyn library call at one Activity only and then passing the object to the another activity.

or 2) should I put each Activity have its own alljoyn library call?

If i said alljoyn library call it means this code:

static {
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-25 21:58:45 -0700

mitchw gravatar image

If you're going to have multiple Activities in your app, my suggestion would be to put all of your AllJoyn code into an Android Service class, that way it is decoupled from the UI thread and your different Activities in Android. The Android 'Chat' example AllJoyn app has code that shows how to do this. If you follow this approach, you'll only need to make the call to load the library once (inside the Android Service class).

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-06-22 20:56:43 -0700

Seen: 91 times

Last updated: Jun 25 '14