Component based android application -
this might not direct programming-related question, rather architectural based question. challenge i'm facing split android application in several piece it's highly configurable. want deal different customers demands, notice application should not released in google play. today application has components sort of standard , not configurable components. examples of these components actionbarsherlock slidemenu. illustration beneath gives idea
note: workflow 2
, workflow 3
has total different logic , layouts.
some of logic dealt with, have method sending different transaction. type of transaction can email
or webservice
the way handle implementing interface
:
public interface isender { public abstract int send(context c, string attachmentpath, string identifier); }
i have class senderfactory
method of type isender
homecoming isender
object:
public static isender createsender(context context) throws invalidworkflowexception { if(workflowchooser.getworkflow().equals("mail")) homecoming new mailsender(); else if(workflowchooser.getworkflow().equals("webservice")) homecoming new webservicesender(); else throw new invalidworkflowexception("the application doesn't back upwards way of transfering cases"); }
this method called createtransaction
class
public int createtransaction(string pcn, string filename) throws mailexception { seek { isender s = senderfactory.createsender(context); sent = s.send(context, filename, pcn); } catch(invalidworkflowexception e) { _log.error(e.getmessage()); } homecoming sent; } }
this way, application decide type of transaction used based on xml-file
included in build.
as might have figured out, if read long post, want apply whole project, not logic, ui
, create more component-based. wonder best practice, there recommended ways of doing this? have examples of previous projects?
android
No comments:
Post a Comment