I'm kind of a hobbyist programmer that has decided to take on a big task. I know there are many ways to satisfy application requirements but because of my hobbyist status I was looking for advice from more experienced coders that have completed bigger projects.
From memory the UI/main thread cannot open sockets. Another thread is needed for that. So from my little experience with the erlang language I liked the idea of modules and message passing. So I approached the design like that.... every module (thread with a particular purpose) has a looper to handle any messages it receives.
i.e. The app is being created. It looks for valid login credentials and if present sends a login message to the network module. The network module processes the response and sends a message to the UI module to do whatever, change activities. (Something so simple probably can be done from the network module but you get the idea.)
Is this approach overkill? I'm not very familiar with android objects. I have done some reading in the developer reference but it's been sporadic and over a decent amount of time. Not everything pops into my mind that might be useful.
(For example if I wrote a game... playing sounds already threaded? So I don't need a sound module? Tried to separate the graphics from the UI thread and could not get it to work. This question and experience has me wondering if the approach is usable... although my current app is a lot simpler (UI and networking).)
Thanks
From memory the UI/main thread cannot open sockets. Another thread is needed for that. So from my little experience with the erlang language I liked the idea of modules and message passing. So I approached the design like that.... every module (thread with a particular purpose) has a looper to handle any messages it receives.
i.e. The app is being created. It looks for valid login credentials and if present sends a login message to the network module. The network module processes the response and sends a message to the UI module to do whatever, change activities. (Something so simple probably can be done from the network module but you get the idea.)
Is this approach overkill? I'm not very familiar with android objects. I have done some reading in the developer reference but it's been sporadic and over a decent amount of time. Not everything pops into my mind that might be useful.
(For example if I wrote a game... playing sounds already threaded? So I don't need a sound module? Tried to separate the graphics from the UI thread and could not get it to work. This question and experience has me wondering if the approach is usable... although my current app is a lot simpler (UI and networking).)
Thanks