i am new to android (who isn't) and coming primarily from the java mobile area, i got one or two orientation issues. still, i would like to achieve the following:
we already have a working java SE library (as middleware for multiplayer games/apps) and want to make it usable on android. it offers the usual non-blocking methods like login() and sendData() and uses http (we're talking about mobile devices). any data sent by others is fetched and the lib makes a callback to a (single) listener which implements an interface with something like loginCB(). i think you get the idea (ask if not)...
we have a single listener which implements all screens and the like and whic is usually also the "game" screen as well. it reacts to callbacks and events alike, keeping in mind which state it's in to "ignore" or postpone events if needed.
in android, there are usually multiple activities and views and i have difficulties finding the best way to handle the library/network according to androids expectations.
so, i am looking for a reasonable API for android.
my ideas so far:
i could implement an android.application, which implements the listener and then create intents from the callback. that would be fairly complicated (big api, complex data), but would be fairly loose.
or i could tie the application more direct to the views, directly knowing their classes and "relay" callbacks to classes as needed. this way, the login screen could be a tableLayout and the game itself could be graphical or anything. but everyone would just need to relay the callbacks as needed and this is not "android like". the reactions to certain callbacks are then pretty scattered.
another idea: have each activity implement the whole listener and then register all listeners to the application which handles the networking. on callback, each registered activity is called and could react. this could lead to (even more) concurrency.
and that's it. im lost! what else could i do? hand over handles to get the results?